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

previous version: 2.105.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.106.0 comes with 10 major changes and 80 fixed Bugzilla issues. A huge thanks goes to the 35 contributors who made 2.106.0 possible.

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

Compiler changes

  1. Assignment-style syntax is now allowed for alias this

    alias this declarations can now be written using the same alias new = old; syntax as other alias declarations.

    struct S
    {
        int n;
        alias this = n;
        // Equivalent to:
        //alias n this;
    }
    
  2. Catch clause must take only const or mutable exceptions

    In 2.104, throwing qualified types was deprecated.

    It is also unsafe to catch an exception as immutable, inout or shared. This is because the exception may still be accessible through another mutable or non-shared reference. Catching an exception with those qualifiers is now deprecated.

    auto e = new Exception("first");
    try {
            throw e;
    } catch(immutable Exception ie) { // now an error
            e.msg = "second";
            assert(ie.msg == "first"); // would fail
    }
    
  3. Functions can no longer have enum storage class

    enum on a function declaration had no effect other than being equivalent to the auto storage class when no return type was present. That syntax could be confused with enum manifest constants and is now an error:

    enum void f1() { }  // error
    enum f2() { }       // error
    

    Instead, remove enum and use auto where necessary:

    void f1() { }
    auto f2() { }
    
  4. Overloading extern(C) functions is now an error

    Since 2.095.0, defining the same function multiple times in a module is not allowed, since it would result in symbol clashes at link time. Overloading a function with different parameter types is still allowed of course, and works because D mangles symbol names including parameter types. However, some external linkages (such as extern(C), extern(Windows)) don't do this, so overloading them can also result in symbol clashes at link time. Therefore, doing this was deprecated in that release as well.

    This deprecation now turned into an error. As a corrective action, give the function D or C++ linkage, or use a unique function name.

    // Error:
    extern(C) float square(float x) { return x * x; }
    extern(C) double square(double x) { return x * x; }
    
    // Corrective action:
    extern(C) float squaref(float x) { return x * x; }
    extern(C) double squared(double x) { return x * x; }
    
    // Or:
    float square(float x) { return x * x; }
    double square(double x) { return x * x; }
    
  5. Deprecation phase ended for access to private method when overloaded with public method.

    When a private method was overloaded with a public method that came after it, you could access the private overload as if it was public.

    After a deprecation period starting with 2.094, this code is now an error.

    Example:

    struct Foo
    {
        private void test(int) { }
        public void test(string) { }
    }
    ...
    Foo().test(3);
    
  6. Added predefined version identifier VisionOS

    This is Apple's new operating system for their VR/AR device Vision Pro.

Runtime changes

  1. Linux input header translations were added to druntime

    These headers give access to the Linux Input Subsystem userspace API, which is used to read input from e.g. keyboards, touch screens, and game controllers, or to emulate input devices. You can now import them through core.sys.linux:

    import core.sys.linux.input; // linux/input.h
    import core.sys.linux.input_event_codes; // linux/input-event-codes.h
    import core.sys.linux.uinput; // linux/uinput.h
    
  2. Integration with the Valgrind memcheck tool has been added to the garbage collector

    The garbage collector gained a compile-time option to enable integration with Valgrind's memcheck tool. When it is enabled, the GC will communicate with Valgrind and inform it which memory access operations are valid and which are not.

    The integration allows catching memory errors in D programs which mix safe (GC) and unsafe (manual) memory management, for example:

    import core.memory;
    
    void main()
    {
        auto arr = new int[3];
        GC.free(arr.ptr);
        arr[1] = 42; // use after free
    }
    

    To use it, obtain the DMD source code, then include the garbage collector and lifetime implementation into your program's compilation and compile with the -debug=VALGRIND option:

    git clone -b v2.105.0 --depth=1 https://github.com/dlang/dmd
    dmd -g -debug=VALGRIND program.d -Idmd/druntime/src dmd/druntime/src/{core/internal/gc/impl/conservative/gc,rt/lifetime,etc/valgrind/valgrind}.d
    valgrind --tool=memcheck ./program
    

    The option is compatible with other GC debugging build options, such as MEMSTOMP and SENTINEL.

    Dub users can try the following equivalent recipe:

    git clone -b v2.105.0 --depth=1 https://github.com/dlang/dmd
    cat >> dub.sdl <<EOF
    debugVersions "VALGRIND"
    sourceFiles "dmd/druntime/src/core/internal/gc/impl/conservative/gc.d"
    sourceFiles "dmd/druntime/src/rt/lifetime.d"
    sourceFiles "dmd/druntime/src/etc/valgrind/valgrind.d"
    importPaths "dmd/druntime/src"
    EOF
    dub build
    valgrind --tool=memcheck ./program
    

Library changes

  1. Better static assert messages for std.algorithm.iteration.permutations

    Until now, permutations used a template constraint to check if the passed types could be used. If they were not, it was very tedious to figure out why.

    As the template constraint is not used for overload resolution the constrains are moved into static asserts with expressive error messages.

  2. Added std.system.instructionSetArchitecture and std.system.ISA

    A new enum representing the instruction set architecture for the targeted system was added. It is intended for cases where a targeted CPU's ISA is only needed at runtime, such as providing human-readable messages as demonstrated below.

    import std.stdio;
    import std.system;
    
    void main()
    {
        writeln("Hello ", instructionSetArchitecture, " world!");
    }
    

List of all bug fixes and enhancements in D 2.106.0:

DMD Compiler regression fixes

  1. Bugzilla 20655: [REG: 2.072] attribute inference accepts unsafe union access as @safe
  2. Bugzilla 24066: __traits(isAbstractClass) causes a segfault when passed an opaque class
  3. Bugzilla 24078: [REG] crash related to concatenation
  4. Bugzilla 24109: [REG2.103] 'need this' when invoking outer method from inner method
  5. Bugzilla 24110: [REG2.104] Array comparison lowering apparently not handled properly in __traits(compiles)
  6. Bugzilla 24118: ICE / regression from 2.103.1 - segfault on CTFE only code in 2.104.2 and 2.105.0
  7. Bugzilla 24144: [REG2.105] Silent file name index overflow
  8. Bugzilla 24159: BetterC: appending to dynamic arrays no longer errors at compile time
  9. Bugzilla 24171: [REG 2.100] Segfault compiling an empty ddoc file
  10. Bugzilla 24184: [REG 2.103] Segmentation fault accessing variable with align(N) > platform stack alignment
  11. Bugzilla 24188: ICE (Illegal instruction) with missing imported symbol

DMD Compiler bug fixes

  1. Bugzilla 8662: Better error for duplicate labels inside static foreach body
  2. Bugzilla 11455: Overriding template methods should raise a compile error
  3. Bugzilla 14835: Constant folding should not affect front end flow analysis
  4. Bugzilla 18578: First enum value assigned 0 instead of EnumBaseType.init
  5. Bugzilla 19460: C style cast error has wrong line number for functions
  6. Bugzilla 22682: pragma(mangle) does not work for nested functions
  7. Bugzilla 23103: static initialization of associative arrays is not implemented
  8. Bugzilla 23522: Error message when enum type is not integral and a value lacks an initializer
  9. Bugzilla 23686: template instance reused with default alias arg
  10. Bugzilla 23733: Can't use template type parameter as type of alias parameter
  11. Bugzilla 23865: duplicate alias not detected
  12. Bugzilla 24036: assert message in CTFE becomes ['m', 'e', 's', 's', 'a', 'g', 'e'][0..7] if produced using std.format.format
  13. Bugzilla 24051: Safety attrib inference of enum/immut/const decls inconsistent with mutable static variable decls
  14. Bugzilla 24054: return expression expected on noreturn function
  15. Bugzilla 24055: is(x == __parameters) does not work on function pointer/delegate types
  16. Bugzilla 24056: const uninitialized data at module scope is not in TLS
  17. Bugzilla 24065: __traits(getTargetInfo) causes a segfault when passed a non value
  18. Bugzilla 24070: Opaque struct with nested definition when taking pointer segfaults
  19. Bugzilla 24071: When enum has typedef integer constants do not have types determined correctly
  20. Bugzilla 24072: cast(__vector) array literal incorrectly triggers GC error
  21. Bugzilla 24088: A nested function that returns a tuple that is written with short syntax function does not want to compile.
  22. Bugzilla 24105: Dip1000 C variadics not marked as scope should not accept scope arguments
  23. Bugzilla 24107: The error for exceeding the CTFE recursion limit bypasses speculative compilation.
  24. Bugzilla 24108: dmd -H and -X fail when given an importC module
  25. Bugzilla 24117: noreturn can be used as expression
  26. Bugzilla 24121: ImportC: typedef enum fails to compile when generating .di file
  27. Bugzilla 24129: ImportC: MS-Link cannot handle multiple COMDATs with the same name
  28. Bugzilla 24130: ImportC: Windows headers use inline asm with different syntax
  29. Bugzilla 24133: printf format checking of %n allows writing to const pointers
  30. Bugzilla 24139: 'this' corruption in extern(C++) dtor when destructing via TypeInfo_Struct
  31. Bugzilla 24154: ImportC: useless expression parsed as invalid variable declaration
  32. Bugzilla 24156: ImportC: Apple uses __signed as a keyword
  33. Bugzilla 24168: Corrupted if TLS values are passed in ref parameters when compiling with -fPIE
  34. Bugzilla 24174: [CTFE] goto within with statements & catch blocks cause a infinite loop
  35. Bugzilla 24181: reading double parameter from RCX rather than XMM1
  36. Bugzilla 24187: ImportC: _Float32 not defined
  37. Bugzilla 24193: Incorrect size of unions with bit fields
  38. Bugzilla 24199: ImportC: generated .di file uses struct keyword when referring to a type
  39. Bugzilla 24208: [DIP1000] Scope pointer can escape via non-scope parameter of pure nested function
  40. Bugzilla 24209: static aa initialization of static function variable ICE
  41. Bugzilla 24212: [DIP1000] Scope pointer can escape via non-scope parameter of pure virtual function
  42. Bugzilla 24213: [DIP1000] Scope pointer can escape via non-scope parameter of pure delegate
  43. Bugzilla 24257: ImportC: ICE on accessing last _Bool bitfield
  44. Bugzilla 24262: Assert error with bit fields

DMD Compiler enhancements

  1. Bugzilla 5445: DMD does not look for ".dmd.conf" in HOME dir
  2. Bugzilla 10532: Silence some unreachable statement warnings when in a static foreach
  3. Bugzilla 11070: Allow declaration statement in a switch expression
  4. Bugzilla 15752: Diagnostic: Better Error Message for Assigning Incorrect AA Empty Value
  5. Bugzilla 20522: Spurious statement unreachable warning caused by undefined variable
  6. Bugzilla 21520: dmd does not honor the NO_COLOR environment variable
  7. Bugzilla 21852: diagnostic: One-liner errors with formatted Loc should print context when -verrors=context
  8. Bugzilla 23958: ImportC: undefined identifier __builtin__sprintf_chk
  9. Bugzilla 24060: Improve "Cannot create instance of abstract class" error
  10. Bugzilla 24084: Add -nothrow Switch to Compiler
  11. Bugzilla 24173: ImportC: add Microsoft iNN integer literal suffixes

Phobos regression fixes

  1. Bugzilla 24064: Cannot chain() array and immutable Nullable
  2. Bugzilla 24267: [REG 2.106 beta] Grapheme cannot be used as an AA key

Phobos bug fixes

  1. Bugzilla 24049: std.conv.to: string to enum conversion is not documented
  2. Bugzilla 24083: Int128.opCmp's behavior with negative numbers is inconsistent with Int128.opEquals
  3. Bugzilla 24140: Int128.opBinary [+-*/%&|^] with negative long arguments gives wrong answers
  4. Bugzilla 24207: std.parallelism: AbstractTask private data is inadvertently available

Phobos enhancements

  1. Bugzilla 24082: add Int128.toString that supports std.format
  2. Bugzilla 24142: Allow casting Int128 to integral and floating types

Druntime bug fixes

  1. Bugzilla 24079: core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer
  2. Bugzilla 24106: core.stdc.math provides an implementation of modfl for uClibc that only works when real and double are the same size
  3. Bugzilla 24123: More importc definitions are needed for macOS
  4. Bugzilla 24230: Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone

dlang.org bug fixes

  1. Bugzilla 3396: Compiler accepts call of superclass abstract method with no implementation

dlang.org enhancements

  1. Bugzilla 24012: [spec/cpp_interface] _d_dynamicArray generated by -HC not documented

Contributors to this release (35)

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

previous version: 2.105.0