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

previous version: 2.098.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.099.0 comes with 6 major changes and 165 fixed Bugzilla issues. A huge thanks goes to the 72 contributors who made 2.099.0 possible.

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

Compiler changes

  1. The '-preview=intpromote' switch is now set by default.

    Integer promotions now follow C integral promotions rules consistently It affects the unary - and ~ operators with operands of type byte, ubyte, short, ushort, char, or wchar. The operands are promoted to int before the operator is applied, and the resulting type will now be int.

    To revert to the old behavor, either use the '-revert=intpromote' switch, or explicitly cast the result of the unary operator back to the smaller integral type:

    void main()
    {
        // Note: byte.max = 127, byte.min = -128
        byte b = -128;
        int x = -b; // new behavior: x = 128
        int y = cast(byte)(-b); // old behavior: y = -128
        byte b2 = cast(byte) -b; // cast now required
    }
    
  2. Added __traits(initSymbol) to obtain aggregate initializers

    Using __traits(initSymbol, A) where A is either a class or a struct will yield a const(void)[] that holds the initial state of an instance of A. The slice either points to the initializer symbol of A or null if A is zero-initialised - matching the behaviour of TypeInfo.initializer().

    This traits can e.g. be used to initialize malloc'ed class instances without relying on TypeInfo:

    class C
    {
        int i = 4;
    }
    
    void main()
    {
        const void[] initSym = __traits(initSymbol, C);
    
        void* ptr = malloc(initSym.length);
        scope (exit) free(ptr);
    
        ptr[0..initSym.length] = initSym[];
    
        C c = cast(C) ptr;
        assert(c.i == 4);
    }
    

Library changes

  1. chunkBy @safe with forward ranges and splitWhen fully @safe

    std.algorithm.iteration.splitWhen now infers safety from the underlying range, as most Phobos ranges do. std.algorithm.iteration.chunkBy also does that when instantiated with a forward range. Inference for chunkBy with a non-forward input range is not yet implemented, though.

    @safe void fun()
    {
        import std.algorithm;
    
        // Grouping by particular attribute of each element:
        auto data = [
            [1, 1],
            [1, 2],
            [2, 2],
            [2, 3]
        ];
    
        auto r1 = data.chunkBy!((a,b) => a[0] == b[0]);
        assert(r1.equal!equal([
            [[1, 1], [1, 2]],
            [[2, 2], [2, 3]]
        ]));
    
        auto r2 = [1, 2, 3, 4, 5, 6, 7, 8, 9].splitWhen!((x, y) => ((x*y) % 3) > 0);
        assert(r2.equal!equal([
            [1],
            [2, 3, 4],
            [5, 6, 7],
            [8, 9]
        ]));
    }
    
  2. std.csv can now optionally handle csv files with variable number of columns.

    By default std.csv will throw if the number of columns on a line is not equal to the number of columns of the first line. To allow, or disallow, a variable amount of columns a bool can be passed to all overloads of the csvReader function as shown below.

    string text = "76,26,22\n1,2\n3,4,5,6";
    auto records = text.csvReader!int(',', '"', true);
    
    assert(records.equal!equal([
        [76, 26, 22],
        [1, 2],
        [3, 4, 5, 6]
    ]));
    

Dub changes

  1. Windows: Copy PDB files to targetPath, alongside executable/DLL

    If the default PDB file is generated when linking an executable or DLL (e.g., no /PDB:my\path.pdb lflag), it is now copied to the target directory too.


List of all bug fixes and enhancements in D 2.099.0:

DMD Compiler regression fixes

  1. Bugzilla 20133: [REG2.084.0] Bogus slice assignment in recursive CTFE call
  2. Bugzilla 20998: error in static struct initialization causes wrong position for subsequent members, producing extra errors
  3. Bugzilla 21039: alias this returns 'null' for ref types when put into array initializer
  4. Bugzilla 21367: Nameless union propagates copy constructors and destructors over all members
  5. Bugzilla 21380: A case of compiler crash when using auto ref
  6. Bugzilla 21438: Compiler segfault on static array in a struct at CTFE
  7. Bugzilla 21538: Overriding with more attributes on delegate parameter is allowed
  8. Bugzilla 21719: [REG 2.072] "auto" methods of classes do not infer attributes correctly.
  9. Bugzilla 22004: [REG2.097] Error: mismatched function return type inference of void and noreturn
  10. Bugzilla 22151: Compiler crash when attempting to assign to function
  11. Bugzilla 22226: [REG 2.095.1] __ctfe + function call in conditional expression used to initialize struct member in constructor causes ICE
  12. Bugzilla 22254: Template instantiated twice results in different immutable qualifier
  13. Bugzilla 22300: [REG 2.098-rc.2] -checkaction=context of a shared type with an opCast fails to compile
  14. Bugzilla 22410: [REG2.094] function with tuple parameter with default argument fails if there's a qualifier
  15. Bugzilla 22420: [REG2.098] Apparent CTFE regression wrt. alias this
  16. Bugzilla 22472: Invalid error message for void return from non-void functions
  17. Bugzilla 22512: importC: incomplete array type must have initializer

DMD Compiler bug fixes

  1. Bugzilla 3: Finish or remove MatchExp::toElem
  2. Bugzilla 8346: Literals 00 - 07 results in odd errors when used with UFCS
  3. Bugzilla 15711: Incorrect type inferring of [char]/string when passed via recursive template, extracting it from a structure field
  4. Bugzilla 15804: missing UDAs on nested struct template
  5. Bugzilla 17870: Can't alias a mix of parent and child class members
  6. Bugzilla 17977: [DIP1000] destructor allows escaping reference to a temporary struct instance
  7. Bugzilla 19320: -cov and -O yield variable used before set
  8. Bugzilla 19482: attributes incorrectly applied to static foreach local variables
  9. Bugzilla 19660: 'export' keyword on OSX/Linux globals causing segfaults
  10. Bugzilla 19873: function should be by default @system even with -preview=dip1000
  11. Bugzilla 20023: Separate compilation breaks dip1000 / dip1008 @safety
  12. Bugzilla 20691: Converting scope static array to scope dynamic array should be error
  13. Bugzilla 20904: dip1000 implicit conversion delegates error
  14. Bugzilla 21093: [ICE] AssertError@dmd/optimize.d(691): Assertion failure
  15. Bugzilla 21431: Incorrect maximum and actual number of cases in a switch case range is reported
  16. Bugzilla 21794: Internal compiler assertion
  17. Bugzilla 21930: ICE (illegal instruction) with bad code
  18. Bugzilla 21950: cod1: Assertion failure for noreturn parameter
  19. Bugzilla 21952: ice for global / tls variable of type noreturn
  20. Bugzilla 21957: ice when dmd computes the alignment of an union containing a noreturn
  21. Bugzilla 21969: importC: Error: bit fields are not supported
  22. Bugzilla 22104: importC: Parser accepts arrays with incomplete element types
  23. Bugzilla 22124: Corrupted closure when compiling with -preview=dip1000
  24. Bugzilla 22233: importC: (identifier)() incorrectly parsed as a cast-expression
  25. Bugzilla 22236: sizeof an empty C struct should be 0, not 1
  26. Bugzilla 22245: importC: Error: found . when expecting )
  27. Bugzilla 22267: ImportC: typedef-ed variable initialization with RHS in parenthesis doesn't parse
  28. Bugzilla 22277: removing strongly pure function calls is an incorrect optimization
  29. Bugzilla 22283: -preview=in -inline leads to strange error inside object.d
  30. Bugzilla 22285: markdown tables are not parsed correctly
  31. Bugzilla 22287: ambiguous virtual function for extern(C++) under Windows
  32. Bugzilla 22311: dmd slice length is wrong on DWARF
  33. Bugzilla 22315: ImportC: #pragma pack is not implemented
  34. Bugzilla 22323: Link error for virtual destructor of C++ class in DLL
  35. Bugzilla 22342: importC: Error: function 'func()' is not callable using argument types '(int)'
  36. Bugzilla 22356: Can't mixin the return type of a function
  37. Bugzilla 22361: Failed import gives misleading error message
  38. Bugzilla 22362: ImportC: error parsing compound literal with more than one value at function scope.
  39. Bugzilla 22366: [dip1000] scope variable can be assigned to associative array
  40. Bugzilla 22372: Loop index incorrectly optimised out for -release -O
  41. Bugzilla 22375: importC: Error: C non-array initializer not supported yet
  42. Bugzilla 22376: importC: Error: cannot use non-constant CTFE pointer in an initializer
  43. Bugzilla 22387: Noreturn init loses type qualifiers
  44. Bugzilla 22388: Wrong overload selected for @safe delegate
  45. Bugzilla 22389: noreturn functions are allowed to return normally
  46. Bugzilla 22399: importC: Error: static variable cannot be read at compile time
  47. Bugzilla 22400: importC: Error: unknown, when compiling source with typedef'd initializer
  48. Bugzilla 22402: importC: Error: can't subtract '__tag2[1]' from pointer
  49. Bugzilla 22403: importC: Error: cannot pass argument '0' of type 'int' to parameter 'const(char)*'
  50. Bugzilla 22405: importC: Error: cannot modify 'const' expression '(*s).field'
  51. Bugzilla 22406: importC: Error: 'switch' statement without a 'default'; use 'final switch' or add 'default: assert(0);' or add 'default: break;'
  52. Bugzilla 22407: importC: Error: cannot implicitly convert expression of type 'extern (C) int(int a)' to 'const(extern (C) int function(int))'
  53. Bugzilla 22409: importC: [ICE] Error: struct no size because of forward reference
  54. Bugzilla 22411: importC: Error: cannot implicitly convert expression of type 'const(char*)' to 'char*'
  55. Bugzilla 22413: importC: Error: array index 0 is out of bounds
  56. Bugzilla 22415: importC: Deprecation: switch case fallthrough - use 'goto case;' if intended
  57. Bugzilla 22421: static foreach introduces semantic difference between indexing and iteration variable
  58. Bugzilla 22461: OpenBSD: Use fmodl
  59. Bugzilla 22462: OpenBSD: bash lives in /usr/local
  60. Bugzilla 22463: OpenBSD: Allow DMD to work on 32-bit OpenBSD
  61. Bugzilla 22467: DWARF: wchar_t reports wrong DECL attributes
  62. Bugzilla 22510: Structs with copy constructor can not be heap allocated with default constructor
  63. Bugzilla 22515: Aggregate definition with qualifiers has inconsistencies between structs and classes
  64. Bugzilla 22517: [REG 2.093][ICE] Bus error at dmd/lexer.d:398
  65. Bugzilla 22533: OpenBSD: Use correct size_t compat for 32-bit
  66. Bugzilla 22566: Error: unknown architecture feature 4+avx for -target

DMD Compiler enhancements

  1. Bugzilla 7925: extern(C++) delegates?
  2. Bugzilla 11008: Allow -main switch even if user-defined main function exists
  3. Bugzilla 20340: [betterC] -main inserts D main function even with betterC
  4. Bugzilla 21160: DWARF: DW_AT_main_subprogram should be emitted for _Dmain
  5. Bugzilla 22113: Allow noreturn as a type for main function
  6. Bugzilla 22198: Compile time bounds checking for static arrays
  7. Bugzilla 22278: [Conditional Compilation] there should be in and out flags
  8. Bugzilla 22353: Header generation is producing trailing whitespace on attribute declarations
  9. Bugzilla 22354: Header generation is producing trailing whitespace on enum declarations
  10. Bugzilla 22355: LLD fallback for mscoff is broken in the presence of some old VS versions
  11. Bugzilla 22377: Show location for Windows extern(C++) mangling ICE
  12. Bugzilla 22379: OpenBSD: link -lexecinfo to get backtrace symbols
  13. Bugzilla 22419: Allow return type inference for main
  14. Bugzilla 22423: DWARF DW_TAG_subprogram should generate DW_AT_decl_column
  15. Bugzilla 22426: DWARF DW_AT_noreturn should be present when function is noreturn
  16. Bugzilla 22459: DWARF: delegate type names should be distinguishable
  17. Bugzilla 22468: DWARF: dchar type is missing encoding
  18. Bugzilla 22471: DWARF: generated main is not marked as DW_AT_artificial
  19. Bugzilla 22474: OpenBSD: Add support to test/runnable/dhry.d
  20. Bugzilla 22475: OpenBSD: Disable test/compilable/cdcmp.d on OpenBSD
  21. Bugzilla 22476: OpenBSD: Add OpenBSD to the fail_compilation/fail21227_win.d ignore list
  22. Bugzilla 22477: OpenBSD: Add to fail_compilation/fail3753.d ignore list
  23. Bugzilla 22478: OpenBSD: Add to fail_compilation/invalid_lib.d
  24. Bugzilla 22494: Search paths for dmd.conf missing from dmd man page
  25. Bugzilla 22508: DWARF: associative arrays should report qualified name instead of _AArray__
  26. Bugzilla 22519: [dip1000] cannot take address of ref return

Phobos regression fixes

  1. Bugzilla 16705: [REG2.069] TaskPool.reduce fails to compile "cannot get frame pointer to D main"

Phobos bug fixes

  1. Bugzilla 17037: std.concurrency has random segfaults
  2. Bugzilla 19544: Can't call inputRangeObject on ranges not supported by moveFront
  3. Bugzilla 20554: std.algorithm.searching.all 's static assert produces a garbled error message
  4. Bugzilla 21022: std.range.only does not work with const
  5. Bugzilla 22249: std.experimental.checkedint: Warn.onLowerBound does not compile
  6. Bugzilla 22255: JSONValue.opBinaryRight!"in" is const
  7. Bugzilla 22297: Behavior of minElement and maxElement with empty range is undocumented
  8. Bugzilla 22301: Only use 'from' if a packet was actually received
  9. Bugzilla 22325: ReplaceType fails on templated type instantiated with void-returning function
  10. Bugzilla 22359: joiner over an empty forward range object liable to segfault
  11. Bugzilla 22364: Unreachable warning for collectException[Msg] with noreturn value
  12. Bugzilla 22368: has[Unshared]Aliasing fails to instantiate for noreturn
  13. Bugzilla 22369: Unreachable statements in std.concurrency with noreturn values / callbacks
  14. Bugzilla 22383: Array of bottom types not recognized as a range
  15. Bugzilla 22384: castSwitch confused by noreturn handlers
  16. Bugzilla 22386: Unreachable warning for assertThrown with noreturn value
  17. Bugzilla 22394: std.getopt cannot handle "-"
  18. Bugzilla 22408: Multiple issues in AllImplicitConversionTargets
  19. Bugzilla 22414: clamp(a, b, c) should always return typeof(a)
  20. Bugzilla 22458: OpenBSD: Add OpenBSD to std/system.d OS list
  21. Bugzilla 22487: Array!T.init.data crashes

Phobos enhancements

  1. Bugzilla 17488: Platform-inconsistent behavior from getTempDir()
  2. Bugzilla 21507: SysTime.toISOExtString is unusable for logging or consistent filename creation
  3. Bugzilla 22117: Can't store scope pointer in a SumType
  4. Bugzilla 22340: totalCPUs may not return accurate number of CPUs
  5. Bugzilla 22370: std.concurrency.spawn* should accept noreturn callables
  6. Bugzilla 22393: OpenBSD: Add polyImpl implementation for x86
  7. Bugzilla 22488: data should work with const/immutable Array's
  8. Bugzilla 22511: Nullable is not copyable when templated type has elaborate copy ctor

Druntime regression fixes

  1. Bugzilla 22235: core.demangle does not support noreturn

Druntime bug fixes

  1. Bugzilla 21919: darwin: SEGV in core.thread tests on OSX 11
  2. Bugzilla 22328: Specific D types are used instead of Windows type aliases
  3. Bugzilla 22336: core.lifetime.move doesn't work with betterC on elaborate non zero structs
  4. Bugzilla 22416: Unify polyImpl implementations
  5. Bugzilla 22440: OpenBSD: Sync sysctl.d
  6. Bugzilla 22443: OpenBSD: Fix Fiber support by adding MAP_STACK
  7. Bugzilla 22453: OpenBSD: Add a dummy value for AI_V4MAPPED
  8. Bugzilla 22455: Remove useless conditional assignment of DISABLED_TESTS in posix.mak
  9. Bugzilla 22456: OpenBSD: timer_* functions don't exist on OpenBSD
  10. Bugzilla 22485: OpenBSD: Fix core.sys.openbsd.unistd imports
  11. Bugzilla 22523: DRuntime options passed after -- affect current process

Druntime enhancements

  1. Bugzilla 20936: core.sync.rwmutex should have shared overloads (and make it usable in @safe code)
  2. Bugzilla 21005: Speed up hashOf for associative arrays
  3. Bugzilla 22378: OpenBSD: execinfo.d and unistd.d aren't being installed
  4. Bugzilla 22395: OpenBSD: Add more OpenBSD-specific function prototypes in string.d and unistd.d
  5. Bugzilla 22439: OpenBSD: Sync mman.d
  6. Bugzilla 22448: OpenBSD: Add OpenBSD-specific alloc and free function prototypes from stdlib.h
  7. Bugzilla 22454: OpenBSD: Add prototypes for pthread_np.h
  8. Bugzilla 22457: OpenBSD: enableDwarf in opApply in runtime.d

dlang.org bug fixes

  1. Bugzilla 22281: unreadable quotes in the upcoming 2.099 changelog
  2. Bugzilla 22417: Slice assignment operator overloading example is incorrect
  3. Bugzilla 22544: [spec] C++ and Objective-C are not single tokens

dlang.org enhancements

  1. Bugzilla 22425: Documentation on implicit conversion of arrays is incomplete
  2. Bugzilla 22431: Add OpenBSD to Third-party downloads list

Installer enhancements

  1. Bugzilla 22078: install.sh: Recognize ARM64 as architecture

Contributors to this release (72)

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

previous version: 2.098.0