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

previous version: 2.111.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.112.0 comes with 9 major changes and 45 fixed Bugzilla issues. A huge thanks goes to the 38 contributors who made 2.112.0 possible.

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

Compiler changes

  1. Keywords auto and ref must be adjacent for auto ref return.

    Similar to auto ref parameters in 2.111, it's now deprecated to declare an auto ref return type without putting those two keywords next to each other as well.

    ref auto int f() => 3;
    auto { ref int g() => 3; }
    
    // Correction:
    auto ref f() => 3;
    auto ref g() => 3;
    
  2. The compiler now accepts -extern-std=c++23

    The compiler now accepts c++23 as a supported standard for -extern-std=. Currently this only changes the value of __traits(getTargetInfo, "cppStd").

Runtime changes

  1. core.int128: Add mul and udivmod overloads for 64-bit operands

    These map to a single x86_64 instruction and have accordingly been optimized via inline assembly.

    import core.int128;
    
    ulong a, b;
    Cent product128 = mul(a, b);
    
    ulong divisor64 = …;
    ulong modulus64;
    ulong quotient64 = udivmod(product128, divisor64, modulus64);
    
  2. Fixed generated binaries crashing on macOS 15.4

    macOS 15.4 has introduced an undocumented ABI change to the format of thread local variable section, which causes almost all executable built with previous D compiler versions to crash during initialization, if they use DRuntime. This release introduces a mitigation for this issue that is backwards compatible with previous versions of macOS.

  3. C Macro translations in druntime have been translated to templates

    This prevents linking errors when using -betterC. For example:

    import core.sys.posix.stdlib;
    import core.sys.posix.unistd;
    
    extern(C) int main()
    {
        int status, pid = vfork();
        if (pid == 0)
        {
            // ...
            return 0;
        }
    
        waitpid(pid, &status, 0);
        if (WIFEXITED(status))
        {
            // ...
        }
        return 0;
    }
    

    This would fail to compile with the -betterC flag:

    Error: undefined reference to `core.sys.posix.sys.wait.WIFEXITED(int)`
           referenced from `main`
    

    The reason is that WIFEXITED is a C macro that was translated to a D function in druntime, which requires linking with druntime to use. Now that it's a template, it will be lazily instantiated and the program compiles.

Library changes

  1. Add lazyCache to std.algorithm.iteration

    The new lazyCache function provides a lazily evaluated range caching mechanism. Unlike cache, which eagerly evaluates range elements during construction, lazyCache defers evaluation until elements are explicitly requested.

    auto result = iota(-4, 5).map!(a => tuple(a, expensiveComputation(a)))().lazyCache();
    // No computations performed at this point
    
    auto firstElement = result.front;
    // First element is now evaluated
    

    See the std.algorithm.iteration.lazyCache documentation for more details.

  2. Add writeText, writeWText, and writeDText to std.conv

    These functions are variants of the existing text, wtext, and dtext functions. Instead of returning a string, they write their output to an output range.

    Like text, writeText can accept an interpolated expression sequence as an argument.

    Example:

    import std.conv : writeText;
    import std.array : appender;
    
    auto output = appender!string();
    output.writeText(i"2 + 2 == $(2 + 2)");
    assert(output.data == "2 + 2 == 4");
    

Dub changes

  1. Fix issue where cImportPaths wasn't working with dmd and ldc

    dub was passing -I instead of -P-I as is required by those compilers

  2. dub.selections.json files are now looked up in parent directories too

    In case the root package directory doesn't contain a dub.selections.json file, dub now looks in parent directories too and potentially uses the first (deepest) one it finds - if and only if that JSON file contains an optional new "inheritable": true flag.

    This allows using a 'central' dub.selections.json file for a repository containing multiple dub projects, making it automatically apply to all builds in that source tree if located in the repository root directory (unless a local dub.selections.json overrides it).

    Such an inherited selections file is never mutated when running dub for a nested project, i.e., changes are always saved to a local dub.selections.json file. E.g., when running dub upgrade for a nested project.


List of all bug fixes and enhancements in D 2.112.0:

DMD Compiler regression fixes

  1. Bugzilla 10440: shared library on osx: worked in 2.062, fails in 2.063 / 2.063.2
  2. Bugzilla 10577: 2.063 Mixin Regression (works with 2.062)
  3. Bugzilla 17481: [REG 2.069.0] synchronized: Access Violation with dmd -O on win32

DMD Compiler bug fixes

  1. Bugzilla 2: Hook up new dmd command line arguments
  2. Bugzilla 4184: associative array with certain key types results in corrupt values during iteration
  3. Bugzilla 4191: [FreeBSD] real constants are rounded to double precision
  4. Bugzilla 4217: Function overloads are not distinguished when instantiating templates
  5. Bugzilla 4224: alias this and opDispatch
  6. Bugzilla 9829: rdmd passes '--' to dmd
  7. Bugzilla 10513: pure overriding method cannot call impure out contract of base class
  8. Bugzilla 10540: variable used before set for empty static arrays, with -inline -O
  9. Bugzilla 10742: CTFE of std.digest.digest.digest() crashes DMD.
  10. Bugzilla 18263: selective import with same name masks out this reference in mixin template
  11. Bugzilla 20318: Illegal instruction (core dumped)
  12. Bugzilla 20499: bad error message caused by UFCS attempt on the identifier matching to an import
  13. Bugzilla 20901: static foreach must deep-copy front() per iteration
  14. Bugzilla 21052: buildkite ldc-developers/ldc log file contains not a clue what it is attempting to do
  15. Bugzilla 21054: Test Suite test/run.d has no documentation on how the dmd under test is specified
  16. Bugzilla 21126: d_do_test should be built with bootstrap compiler, not compiler being tested
  17. Bugzilla 21153: DWARF: DMD emits the mangled name for DW_AT_name
  18. Bugzilla 21179: Test Suite: circleci times out with useless log message
  19. Bugzilla 21225: preview=dtorfields inserts unnecessary dtor call in nothrow ctors
  20. Bugzilla 21271: C++ header generation ignores extern(D) class methods affecting vtable layout

DMD Compiler enhancements

  1. Bugzilla 10491: Type inference for function arguments with default value
  2. Bugzilla 10523: Don't call array op functions for short vector ops
  3. Bugzilla 20075: allow cast(ref T)lvalue for casting lvalues
  4. Bugzilla 20334: posix.mak clean target does not remove all generated files
  5. Bugzilla 21098: poor diagnostic when trying to assign a string literal to a char*
  6. Bugzilla 21203: Accept pragma(mangle) on aggregate types
  7. Bugzilla 21259: struct initialization with deprecated fields should issue deprecation warnings

Phobos bug fixes

  1. Bugzilla 10550: Xorshift32 and Xorshift160 do not generate uniformly-distributed random numbers
  2. Bugzilla 20502: Converting std.typecons.RefCounted!T to a string gives T's storage location instead of T's fields when T is a struct without an explicit toString
  3. Bugzilla 21210: std.traits : isAssignable false positive on disabled copy struct

Phobos enhancements

  1. Bugzilla 21068: Cannot sort a RandomAccessFinite range
  2. Bugzilla 21267: Make std.complex work with -betterC

Druntime bug fixes

  1. Bugzilla 4222: druntime should apply @safe/@system/@trusted
  2. Bugzilla 9584: Exceptions in D are ludicrously slow (far worse than Java)
  3. Bugzilla 10701: [GC] segfault in GC

Druntime enhancements

  1. Bugzilla 9585: [AA] Implement getPair() for Associative Arrays

dlang.org bug fixes

  1. Bugzilla 21150: The specification is unclear (static foreach)
  2. Bugzilla 21189: Plain Old Data and copy constructors
  3. Bugzilla 21241: html display of changelog does not work in Chrome browser

dlang.org enhancements

  1. Bugzilla 18127: homepage: Fast code, fast.
  2. Bugzilla 21105: Casting from a function pointer to a delegate
  3. Bugzilla 21161: [Variadic Templates] uses outdated example from D1 / Tango

Contributors to this release (38)

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

previous version: 2.111.0