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

previous version: 2.100.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,, 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 and running the pending_changelog target:
    make -f posix.mak pending_changelog

2.101.0 comes with 11 major changes and 38 fixed Bugzilla issues. A huge thanks goes to the 33 contributors who made 2.101.0 possible.

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

Compiler changes

  1. Add bit fields to D

    They work just like the bit fields in ImportC do.

    struct B
        int x:3, y:2;
    static assert(B.sizeof == 4);
    int vaporator(B b)
        b.x = 4;
        b.y = 2;
        return b.x + b.y; // returns 6
  2. Added __traits(classInstanceAlignment)

    To complement __traits(classInstanceSize), providing the required alignment for manual buffers etc.:

    align(__traits(classInstanceAlignment, C))
    void[__traits(classInstanceSize, C)] buffer;
  3. Relaxed pragma(crt_constructor) / pragma(crt_destructor) linkage check

    extern(C) isn't a requirement for CRT con/destructors anymore when using the default void () signature.

  4. Print deprecations for scope pointer errors

    The scope attribute has existed for a long time, but the compiler would only verify its semantics when the -preview=dip1000 switch was passed, to avoid breaking code. Pointers or references stored in a scope variable are not allowed to escape the scope in which the variable is defined.

    Usually, it is not necessary to mark variables scope, since the Garbage Collector (GC) takes care of freeing memory. However, D allows creating pointers / slices that point to local variables, which use Stack-based memory allocation and are destructed at the end of their scope. It is important that in @safe code, creating such pointers is either disallowed, or has scope semantics enforced, but the compiler would formerly fail to do that:

    int[] getSlice()
        int[4] stackBuffer;
        int[] slice = stackBuffer[]; // slice points to local variable allocated on stack
        return slice; // dangling pointer!
    struct S
        int x;
        int* get()
            int* y = &this.x; // this struct instance could be a local variable
            return y; // dangerous!

    Starting with this release, scope semantics are enforced in @safe code on pointers to stack memory, but only as deprecation warnings. Eventually, they will be turned into errors. To turn them into errors immediately, use -preview=dip1000. To disable the deprecations, use -revert=dip1000.

    Note that the original DIP1000 text is outdated, so please refer to the specification pages for documentation:

  5. Improvements for the C++ header generation

    The following features/bugfixes/improvements were implemented for the experimental C++ header generator:

    • Overriding virtual functions are now marked with the override keyword when generating C++11 compatible headers.
    • Final virtual functions are now marked with the final keyword when generating C++11 compatible headers.

    Note: The header generator is still considered experimental, so please submit any bugs encountered to the bug tracker.

  6. ImportC now recognizes the typeof(...) operator

    ISO C does not specify a typeof operator, but it is a widely-implemented vendor extension. ImportC now implements this extension as well.

    Only the form typeof(...) is recognized, other compilers also support (or only support one of) __typeof__(...) and __typeof(...). Imported C using these forms will need to be normalized with #defines.

  7. Removed the -transition=markdown and -revert=markdown switches

    This release removes the -transition=markdown, which prints markdown substitutions made when processing markdown in ddoc documentation blocks, and -revert=markdown switches which disables markdown substitutions in ddoc documentation blocks.

    Markdown substitutions have been the default for some time now, and as of this release is always performed.

Runtime changes

  1. Posix (excl. Darwin): Switch default GC signals from SIGUSR1/2 to SIGRTMIN/SIGRTMIN+1

    As the SIGUSR ones might be used by 'system' libraries (e.g., Android Dalvik VM or LLVM libFuzzer), while the SIGRT ones are reserved for user-defined purposes and less likely to collide.

    The used signals can still be customized with an early call to core.thread.osthread.thread_setGCSignals().

Library changes

  1. std.socket.Socket methods now accept only scope arrays.

    To comply with dip1000, std.socket.Socket methods now all have scope attributes applied to any slice parameters. This includes receive and send flavors, and also setOption. While not technically a breaking change for users of Socket, if you derive from it, you must apply those attributes to your derivatives or it will fail to compile. However, applying the attributes is backwards compatible with previous versions of Phobos, so there is no need for a migration path.

  2. Add custom fill value to std.outbuffer.OutBuffer class

    Extend the fill, alignSize, align{2,4} methods of std.outbuffer.OutBuffer to specify value to write when filling (up to an alignment).

    For flash device images it is desirable to use 0xff as the fill value, because 0xff is the value of the unprogrammed flash memory cell. Padding with 0 requires to programm the flash cell from 0xff to 0x00, which increases wear and tear on the flash memory device. Usually there is some larger block at the end if the flash memory image, which must be padded up to the size of the flash device (usually a power of two). Instead of padding with 0x00 the PR allows to fill with 0xff instead.

    There might be also some other use-cases, where it might be reasonable to fill the alignment gaps with some other value than 0x00, e.g. when debugging and viewing output data in a hex editor. It is easier to spot gaps, when the padded spaces contain a custom value like 0x55 or 0xaa.

    A new fill method was added, which allows filling with a user-defined value instead of the 0 as in the previous implementation.

    OutBuffer buf = new OutBuffer();
    buff.fill( 1234, 42 ); // Fills 1234 bytes with 42 starting at buf.offset
    buff.fill( 10 );       // Same as fill0( 10 );

    The alignSize, align{2,4} methods were modified to use some user-defined value for padding to the requested alignment boundary.

    OutBuffer buf = new OutBuffer();
    buf.write(cast(ubyte) 1);
    assert(buf.toBytes() == "\x01\x55");
    buf.write(cast(ubyte) 2);
    assert(buf.toBytes() == "\x01\x55\x02\x55");
    buf.write(cast(ubyte) 3);
    buf.alignSize(8, 0x55);
    assert(buf.toBytes() == "\x01\x55\x02\x55\x03\x55\x55\x55");

Dub changes

  1. Building the special test runner configuration

    dub build --config=unittest --build=unittest[-cov] can now be used to mimic building the test runner executable of dub test [--coverage]. Note that this doesn't require an existing unittest configuration.

    dub describe --config=unittest allows to derive the path to the executable.

List of all bug fixes and enhancements in D 2.101.0:

DMD Compiler regression fixes

  1. Bugzilla 23019: Missing filename when -of points to an existing directory

DMD Compiler bug fixes

  1. Bugzilla 16575: [ICE] extern(C++) function with D specific types
  2. Bugzilla 21314: ICE on extern(c++) static class variables
  3. Bugzilla 21416: betterC mode program with C++ interface fails to link
  4. Bugzilla 21676: [ICE][SIMD] DMD crashing with SIMD + optimizations + inlining
  5. Bugzilla 22108: DIP1000 parameter mistakenly interpreted as return scope instead of scope
  6. Bugzilla 22664: Disassembler mistakes rdtscp for invlpg ECX
  7. Bugzilla 22865: __traits(compiles) affects inferrence of attributes
  8. Bugzilla 23009: [CODEGEN][SIMD] SIMD + optimizations + inlining + double
  9. Bugzilla 23012: importC: asm label to set symbol name not applied from forward declaration
  10. Bugzilla 23018: importC: syntax error for sizeof with postfix operator on parenthesized expression
  11. Bugzilla 23037: importC: type with only type-qualifier doesn't work
  12. Bugzilla 23038: importC: sizeof inside struct has struct members in scope
  13. Bugzilla 23039: importC: declaration with array length has itself in scope
  14. Bugzilla 23042: -betterC still includes RTInfo
  15. Bugzilla 23044: importC: comma expression with function call parsed as declaration
  16. Bugzilla 23045: importC: casted function type is missing extern(C)
  17. Bugzilla 23047: [ICE][SIMD] Do not SROA vector types
  18. Bugzilla 23050: Incorrect disassembly of code with -vasm and 0xBE and 0xBF opcodes
  19. Bugzilla 23054: importC: struct compound-literal assigned by pointer has wrong storage duration
  20. Bugzilla 23056: importC: dmd asserts for missing return statement in CTFE function
  21. Bugzilla 23057: importC: dmd segfault on invalid syntax
  22. Bugzilla 23068: [betterC] BetterC does not respect -checkaction=halt
  23. Bugzilla 23105: __trait(getMember) and mixin() of the same code as a string behave differently
  24. Bugzilla 23108: ICE: AssertError@src/dmd/clone.d(567): Assertion failure
  25. Bugzilla 23109: ICE: AssertError@src/dmd/dclass.d(449): Assertion failure
  26. Bugzilla 23123: -vasm wrong result for cmpxchg16b
  27. Bugzilla 23138: Overrides of member functions of an inherited class ignores attribute "downcast"

DMD Compiler enhancements

  1. Bugzilla 21673: [SIMD][Win64] Wrong codegen for _mm_move_ss
  2. Bugzilla 22911: dtoh: make include directives sorted for generated headers
  3. Bugzilla 23079: [dip1000] be more lenient when taking address of ref return

Phobos enhancements

  1. Bugzilla 23101: [std.sumtype] canMatch does not account ref

Druntime bug fixes

  1. Bugzilla 15939: GC.collect causes deadlock in multi-threaded environment
  2. Bugzilla 23060: MacOS: core.sys.posix.sys.socket missing some definitions
  3. Bugzilla 23065: importC: __builtin_expect should use c_long
  4. Bugzilla 23067: importC: offsetof macro assumes size_t is defined
  5. Bugzilla 23129: object.destroy doesn't consider initialize=false on D classes bug fixes

  1. Bugzilla 23062: Function/delegate inference example does not compile

Contributors to this release (33)

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

previous version: 2.100.0