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.084.0

previous version: 2.083.0

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.084.0 comes with 9 major changes and 106 fixed Bugzilla issues. A huge thanks goes to the 54 contributors who made 2.084.0 possible.

List of all upcoming bug fixes and enhancements in D 2.084.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 partially 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();
    

List of all bug fixes and enhancements in D 2.084.0:

DMD Compiler regressions

  1. Bugzilla 15206: [REG2.077] ICE on optimized build, tym = x1d Internal error: backend\cgxmm.c 547
  2. Bugzilla 16284: [REG2.067] CTFE internal error: bad compare
  3. Bugzilla 18938: Dmd segfault when compiling this dub package in test release
  4. Bugzilla 19103: Can imports symbols in module to a struct with mixin.
  5. Bugzilla 19202: deprecated eponymous template prints no warning
  6. Bugzilla 19227: S.init is S.init failing for struct with float member
  7. Bugzilla 19337: [Reg 2.082.0] Cannot call std.algorithm.sort twice
  8. Bugzilla 19389: Multiple assignment does not work for struct members
  9. Bugzilla 19409: static if (__traits(compiles, __traits(identifier, ...))) evaluates to false even though the expression alone evaluates to true
  10. Bugzilla 19419: [REG2.080.1] @disabled this() will print wrong error if calling non-default constructor with wrong parameters
  11. Bugzilla 19447: [REG2.066] fixed size slice assignment in ctfe loses connection with array
  12. Bugzilla 19473: DMD Segfault on circular struct reference
  13. Bugzilla 19491: ICE (segfault) when initializing scope variable with shared type
  14. Bugzilla 19510: [2.084 REG] random and spurious error about a missing NOLOGO.d file

DMD Compiler bugs

  1. Bugzilla 5973: alias this is not considered with superclass lookup
  2. Bugzilla 6777: alias this disables casting for classes
  3. Bugzilla 9274: is + alias this = wrong code
  4. Bugzilla 10692: Deprecation isn't checked using alias this
  5. Bugzilla 11499: is-expression misbehaving with 'alias this'
  6. Bugzilla 13392: class + alias this + cast(void*) == overzealous cast
  7. Bugzilla 13953: AA .remove pseudo-method doesn't work via alias this
  8. Bugzilla 14632: Diagnostic improvement for invalid cast with alias this
  9. Bugzilla 15876: various cases of SEGFAULT when formatting parser errors
  10. Bugzilla 16082: Can't access alias this member with same name as module
  11. Bugzilla 16086: Imported function name shadows alias this member
  12. Bugzilla 16479: Missing substitution while mangling C++ template parameter for functions
  13. Bugzilla 16633: Case where an alias this is tried before the object itself
  14. Bugzilla 16976: Implicit conversion from ulong to int in foreach_reverse
  15. Bugzilla 18010: Undefined reference to _d_arraycopy when copying arrays in -betterC
  16. Bugzilla 18456: crt_constructor/crt_destructor segfaults if -lib
  17. Bugzilla 18572: AliasSeq default arguments are broken
  18. Bugzilla 18979: Template constructor bypasses private
  19. Bugzilla 19014: Compiler imports symbols that aren't actually imported.
  20. Bugzilla 19086: Bad stack trace for exceptions
  21. Bugzilla 19163: static/tuple foreach counted incorrectly in coverage analysis
  22. Bugzilla 19307: Variables moved to a closure show nonsense in debugger
  23. Bugzilla 19318: Variables captured from outer functions not visible in debugger
  24. Bugzilla 19319: No line number when std.math is missing for x ^^ y
  25. Bugzilla 19336: [ICE] segfault on invalid code
  26. Bugzilla 19376: Do not generate object file from .di file passed on command line
  27. Bugzilla 19381: capture pointer in nested function should not be called "this"
  28. Bugzilla 19393: Structure dtor isn't called after passed to T[]... argument. Memory leaks issue
  29. Bugzilla 19415: return non-copyable struct fails if member function has return attribute
  30. Bugzilla 19464: typeof immutable fields order dependent
  31. Bugzilla 19497: the program crash using dmd with -O, it works fine without optimizations.
  32. Bugzilla 19520: assert(TypeExp is TypeExp): compiles with empty structs

DMD Compiler enhancements

  1. Bugzilla 1870: Reproduce offending lines in error messages for string mixins
  2. Bugzilla 7804: Cannot alias __traits directly
  3. Bugzilla 12790: Compiler should keep mixin file around for debugging purposes
  4. Bugzilla 16165: Show expected number of function arguments on mismatch
  5. Bugzilla 19246: Binary literal 0b_ allowed
  6. Bugzilla 19278: extern(C++, "name") doesn't accept expressions
  7. Bugzilla 19439: Make __traits(getAliasThis) return empty tuple for non-aggregate types

Phobos regressions

  1. Bugzilla 13300: pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit'
  2. Bugzilla 18824: [REG 2.080] Tuple's opBinaryRight takes precedence over appending a tuple to an array of tuples
  3. Bugzilla 19133: core.exception.rangeerror@std/file.d(3812):
  4. Bugzilla 19213: goto skips declaration of variable in std.algorithm.iteration.joiner
  5. Bugzilla 19444: hasRawAliasing loops on class with static array, cannot swap class refs

Phobos bugs

  1. Bugzilla 4957: std.concurrency does not allow to pass Tid in struct fields
  2. Bugzilla 18327: std.random.XorshiftEngine is parameterized by UIntType but only works with uint
  3. Bugzilla 18680: std.random.LinearCongruentialEngine has opEquals but no toHash
  4. Bugzilla 18755: std.typecons.Rebindable breaks @safe-ty
  5. Bugzilla 18778: std.format: Positional arguments do not work as expected with nesting
  6. Bugzilla 18796: std.algorithm.substitute asserts on empty range
  7. Bugzilla 19331: std.regex.internal.ir.SmallFixedArray.toHash is ignored because it's non-const
  8. Bugzilla 19338: std.bitmanip.BitArray.count gives segfault for empy BitArray
  9. Bugzilla 19366: Qualify opCast(bool) as const for findSplit, findSplitBefore and findSplitAfter
  10. Bugzilla 19367: std.net.curl does not understand HTTP/2 status lines
  11. Bugzilla 19456: ParameterIdentifierTuple incorrect for abstract methods with unnamed parameters

Phobos enhancements

  1. Bugzilla 5502: More handy ways to create associative arrays
  2. Bugzilla 9702: std.string.replace for single chars too?
  3. Bugzilla 10930: std.array.replace cannot simple replace an element in array
  4. Bugzilla 18595: std.random: add unpredictableSeedOf!UIntType for non-uint unpredictableSeed
  5. Bugzilla 19164: malloc may be considered pure when failure results in program exit (no need to reset errno)
  6. Bugzilla 19197: Replace instances of typeid(T).getHash(..) with hashOf
  7. Bugzilla 19238: no-arg splitter should work on ranges of characters
  8. Bugzilla 19308: Optimize std.string.stripLeft
  9. Bugzilla 19364: Decrease template bloat for string functions
  10. Bugzilla 19396: [betterC] ScopeBuffer can't be used in betterC with inline
  11. Bugzilla 19403: Make std.string.stripLeft on char array @nogc nothrow
  12. Bugzilla 19404: Optimize std.string.stripRight
  13. Bugzilla 19405: Speed up backwards UTF-8 decoding in stripRight & make nogc nothrow for strings
  14. Bugzilla 19429: indexOf("a", "b") should be nothrow/@nogc
  15. Bugzilla 19466: functionLinkage documentation omits some values

Druntime regressions

  1. Bugzilla 19498: undefined identifier rt_loadLibraryW

Druntime bugs

  1. Bugzilla 8872: Missing extended window styles (WS_EX_... enumeration) in windows header
  2. Bugzilla 11168: core.stdc.time.asctime() is incorrectly marked as @trusted
  3. Bugzilla 11174: Both AF_PACKET and SO_BINDTODEVICE undefined
  4. Bugzilla 11294: Object destruction with alias this
  5. Bugzilla 19087: final switch cannot be used in -betterC
  6. Bugzilla 19090: core.internal.hash.bytesHash unit test uses incorrect test vector on BigEndian machines
  7. Bugzilla 19204: hashOf doesn't accept SIMD vectors
  8. Bugzilla 19332: hashOf fails to compile for const struct that has non-const toHash & has all fields bitwise-hashable
  9. Bugzilla 19401: Fix bug in core.internal.traits.hasElaborateDestructor & hasElaborateCopyConstructor for struct with static array alias & for nested structs/unions
  10. Bugzilla 19433: Don't consume --DRT-* options if rt_cmdline_enabled is false

Druntime enhancements

  1. Bugzilla 19214: Support object.destruct() for efficient (and correct!) destruction
  2. Bugzilla 19398: Document meaning of core.atomic.MemoryOrder
  3. Bugzilla 19414: object.__cmp(T[]) on big-endian architectures can use memcmp for unsigned integers of any size
  4. Bugzilla 19416: Make core.exception.onOutOfMemoryError work in betterC
  5. Bugzilla 19421: Make pureMalloc, etc. usable in BetterC
  6. Bugzilla 19423: In core.stdc.errno directly link __errno on OpenBSD & NetBSD
  7. Bugzilla 19424: Add Haiku support to core.stdc.errno
  8. Bugzilla 19468: Improve cyclic dependency error message

dlang.org bugs

  1. Bugzilla 19374: TypeVector undefined in grammar

dlang.org enhancements

  1. Bugzilla 19321: Unions "may not" have fields with destructors

Installer bugs

  1. Bugzilla 19434: "Invalid signature" when using install.sh with no ~/.gnupg

Contributors to this release (54)

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

previous version: 2.083.0