Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

Change Log: 2.083.0

previous version: 2.082.1

Download D nightlies
To be released


This changelog has been automatically generated from all commits in master since the last release.

  • The full-text messages are assembled from the changelog/ directories of the respective repositories: dmd, druntime, phobos, tools, dlang.org, installer, and dub.
  • See the DLang-Bot documentation for details on referencing Bugzilla. The DAutoTest PR preview doesn't include the Bugzilla changelog.
  • The pending changelog can be generated locally by setting up dlang.org and running the pending_changelog target:
    make -f posix.mak pending_changelog


2.083.0 comes with 12 major changes and 43 fixed Bugzilla issues. A huge thanks goes to the 48 contributors who made 2.083.0 possible.

List of all upcoming bug fixes and enhancements in D 2.083.0.

Compiler changes

  1. Add CppRuntime_* version identifiers.

    In order to link against C++ code, it is important to know what C++ runtime the ABI targets.

    Supported version identifiers include:

    • CppRuntime_Clang
    • CppRuntime_DigitalMars
    • CppRuntime_Gcc
    • CppRuntime_Microsoft
    • CppRuntime_Sun

  2. Deprecated CLI switch -gc have been removed

    This switch was deprecated in v2.075.0 and is now removed, meaning DMD will complain about an unrecognized switch. -gc used to pretend to be C, but debuggers have been D-aware for around a decade.

  3. Expose __traits(isZeroInit, T)

    Takes one argument which must be a type. If the type's default initializer has no non-zero bits then true is returned, otherwise false. isZeroInit will always return true for a class C because C.init is a null reference.

    This property was already being computed internally by the compiler so exposing it via __traits is more efficient than re-implementing it in library code.

    struct S1
    {
        int x;
    }
    
    struct S2
    {
        int x = -1;
    }
    
    static assert(__traits(isZeroInit, S1));
    static assert(!__traits(isZeroInit, S2));
    
    void test()
    {
        int x = 3;
        static assert(__traits(isZeroInit, typeof(x)));
    }
    
  4. Implement new C++ mangling syntax

    The new syntax allows for keywords to be used for mangling and only changes the mangle of a symbol. It does not provide any feature resembling C++ namespaces. This allows users to structure their C++ in traditional D fashion, utilizing modules. The old syntax extern(C++, foo) would occupy the symbol foo. This meant modules couldn't use this name and match the C++ namespace.

    extern(C++, "__traits") void foo();
    
    extern(C++, "std", "chrono") void bar(); // multiple namespace syntax
    
    int std; // no symbol clashing with above extern(C++, "std", ...)
    
  5. Add pragma(linkerDirective), to emit linker directives into object files.

    Emits a custom linker directive to the object file, eg:

    pragma(linkerDirective, "/alternatename:_pWeakValue=_pDefaultWeakValue");
    

    This is only supported for MS-COFF output.

  6. fix Issue 14246 - RAII - proper destruction of partically constructed objects

    Since destructors for object fields can now get called by the constructor for that object if the constructor fails, the attributes of the destructors must be covariant with the attributes for the constructor.

    I.e. if the constructor is marked @safe, the fields' destructors must also be @safe or @trusted.

    Since this behavior was never checked before, this fix causes breakage of existing code. Hence, enabling this behavior is behind the new transition=dtorfields compiler switch. It will eventually become the default behavior, so it is recommended to fix any of these destructor attribute issues.

  7. Add __traits(getTargetInfo, "key") to query details about the compilation target.

    getTargetInfo accepts a string key as argument to select the target detail of interest.

    static if (__traits(getTargetInfo, "cppRuntimeLibrary") == "msvcrtd") { ... }
    
    static assert (__traits(getTargetInfo, "not_a_target_info") == "??"); // <- error: no such targetInfo "not_a_target_info"!
    

    getTargetInfo keys are implementation defined, allowing relevant data for exotic targets. A reliable subset which are always available shall be mentioned in the spec.

Library changes

  1. std.algorithm.iteration.each is now capable of early-stopping

    std.algorithm.iteration.each is now capable of exiting early. When a No.each std.typecons.Flag is returned from the function that is called by each, the iteration will be aborted early. Analogously, returning Yes.each will continue the iteration. For example:

    auto arr = [10, 20, 30];
    arr.each!((n) { arr ~= n; return (n == 20) ? No.each : Yes.each; }); // aborts after the second iteration
    assert(arr == [10, 20, 30, 10, 20]);
    
  2. toHash function has been added to std.experimental.checkedint.Checked

    Custom hashing can be implemented in a Hook. If no hashing is specified, then the built-in function will be used. Checked can now be used with associative arrays.

    import std.experimental.checkedint;
    
    static struct MyHook
    {
        static size_t hookToHash(T)(T payload)
        {
            auto h = typeid(payload).getHash(&payload);
            return h + 0x9e3779b9 + (h << 6) + (h >> 2);
        }
    }
    
    auto h = checked!MyHook(142).toHash();
    

Dub changes

  1. betterC build option has been added

    This build option can be used to pass -betterC argument to DMD or LDC:

    dub.json:

    "buildOptions": ["betterC"]
    

    dub.sdl:

    buildOptions "betterC"
    
  2. Environment variable DUB_PACKAGE_VERSION added

    DUB now supports the environment variable DUB_PACKAGE_VERSION containing the version of the package

  3. Dub now supports a minDubVersion field.

    This field will abort the build if the user doesn't have a recent enough version of dub and miss needed feature to perform the build.

    minDubVersion can be added to project's dub.json:

    {
        ...
        "minDubVersion": "1.10"
        ...
    }
    

    or dub.sdl:

    minDubVersion "1.10"
    

List of all bug fixes and enhancements in D 2.083.0:

DMD Compiler regressions

  1. Bugzilla 19248: Wrong mangle for C++ const STL classes/structs

DMD Compiler bugs

  1. Bugzilla 11538: [ICE] stack overflow with recursive NullableRef fails
  2. Bugzilla 14246: RAII - proper destruction of partially constructed objects/structs
  3. Bugzilla 15374: [internal] Nothing should import ddmd.mars
  4. Bugzilla 18771: Identical overload sets in different modules have different identities
  5. Bugzilla 18955: extern(C++) default struct mangling is overridden when interacting with a cppmangle = class template
  6. Bugzilla 19098: Improve error for non-assignable struct
  7. Bugzilla 19181: Semantic errors in opDispatch argument lead to "no property X"
  8. Bugzilla 19182: missing semicolon crashes compiler
  9. Bugzilla 19185: [ICE] Nested struct segfaults when using variable from outer scope
  10. Bugzilla 19201: Error: func called with argument types (ulong) matches both: __c_long and __c_ulong
  11. Bugzilla 19209: [ICE] Overriding a field in a baseclass issues an ICE
  12. Bugzilla 19225: Confusing error message on static else
  13. Bugzilla 19251: Alias this does not get called on struct qualified type
  14. Bugzilla 19284: alias this not used in nested functions of a method

DMD Compiler enhancements

  1. Bugzilla 15512: extern(C++, ns) should consider taking a string
  2. Bugzilla 19180: Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T)
  3. Bugzilla 19194: version for -mscrtlib specification
  4. Bugzilla 19195: Support pragma to specify linker directives
  5. Bugzilla 19199: Use core.bitops intrinsics during CTFE
  6. Bugzilla 19203: alias this to a bool behaves both inconsistently and incorrectly with static assert
  7. Bugzilla 19212: Add versions for C++ runtimes.
  8. Bugzilla 19292: Mixin expressions should take an argument list the same as pragma(msg) does

Phobos bugs

  1. Bugzilla 11431: std.file.slurp fails with Windows newlines
  2. Bugzilla 11959: Phobos should not declare public symbols in version(unittest) blocks
  3. Bugzilla 17276: BaseClassesTuple fails on extern C++ classes that implement an interface without a base class
  4. Bugzilla 18675: std.experimental.checkedint.Checked has opEquals but no toHash
  5. Bugzilla 18683: std.containers.rbtree.RedBlackTree has opEquals but no toHash
  6. Bugzilla 18838: Formatting the number zero with separator doesn't obey width specifier
  7. Bugzilla 19085: std.experimental.allocator.makeArray should work with void
  8. Bugzilla 19200: Variant operators don't overload correctly
  9. Bugzilla 19228: hasAliasing fails on static arrays
  10. Bugzilla 19240: std.typecons.Tuple should check for reserved identifiers
  11. Bugzilla 19275: std.process: redirecting output in a non-console application fails
  12. Bugzilla 19289: std.range.transposed with enforceNotJagged not throwing

Phobos enhancements

  1. Bugzilla 18142: checkedint opOpAssign doesn't accept a checkedint
  2. Bugzilla 19236: Replace runtime typeid(T).initializer().ptr is null checks with compile-time __traits(isZeroInit, T)
  3. Bugzilla 19257: std.array.join does not handle const fields that cannot be converted to mutable

Druntime bugs

  1. Bugzilla 19250: DWARF Backtraces with very long symbol names read out of bounds when printing
  2. Bugzilla 19262: hashOf associative array should infer nothrow
  3. Bugzilla 19282: hashOf segfaults for non-null C++ objects

Druntime enhancements

  1. Bugzilla 19280: Remove unnecessary error checks in core.time.currSystemTick and currTime

dlang.org bugs

  1. Bugzilla 18104: Alias example compiles where it states that it should be illegal

Contributors to this release (48)

A huge thanks goes to all the awesome people who made this release possible.

previous version: 2.082.1