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

previous version: 2.109.1

Download D 2.110.0 Beta
to be released Aug 01, 2024

2.110.0 comes with 4 major changes and 28 fixed Bugzilla issues. A huge thanks goes to the 27 contributors who made 2.110.0 possible.

List of all bug fixes and enhancements in D 2.110.0.

Compiler changes

  1. Copying from const(void)[] to void[] is disallowed with -preview=fixImmutableConv

    If const(void)[] data contains tail const pointers, copying to void[] can subsequently violate const data:

    void f(int*[] a, const int*[] b)
        void[] va = a;
        const void[] vb = b;
        va[] = vb[]; // fills `a` with pointers to const
        *a[0] = 0; // const data mutated

    Copying vb data to va is no longer allowed with the -preview=fixImmutableConv switch.

  2. Import expressions are now treated as hex strings

    While Import expressions are typed as string, they are also used to embed binary files. By treating them the same as hex strings, they will implicitly convert to arrays of integral types other than char.

    // Formerly, a cast was required:
    immutable ubyte[] iconImg = cast(immutable ubyte[]) import("icon.png");
    // Now, it implicitly converts to integral arrays:
    immutable ubyte[] iconImg = import("icon.png");
  3. bool values other than 0 or 1 are not @safe

    The spec was updated (for 2.109) so that only 0 and 1 are safe values for bool. This means that reading a bool value whose underlying byte representation has other bits set is implementation-defined and should be avoided. Consequently the following are deprecated in @safe code:

    • void initialization of booleans (since 2.109)
    • Reading a bool field from a union (since 2.109)
    • Runtime casting a dynamic array to a bool dynamic array type
    • Runtime casting a bool dynamic array to a tail mutable dynamic array type
    • Casting a pointer to a bool pointer type
    • Casting a bool pointer to a tail mutable pointer type

Dub changes

  1. 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.110.0:

DMD Compiler bug fixes

  1. Bugzilla 12885: const union wrongly converts implicitly to mutable
  2. Bugzilla 17148: Copying from const(void)[] to void[] breaks immutable
  3. Bugzilla 23957: Casting to derived extern(C++) class is unsafe
  4. Bugzilla 24534: Having a label on a declaration makes it possible to skip it with goto
  5. Bugzilla 24558: C asserts segfault on Glibc
  6. Bugzilla 24577: Struct with constructor returned from C++ wrong
  7. Bugzilla 24582: Detect unsafe cast(bool[])
  8. Bugzilla 24583: di generator emits return scope and scope return in wrong order
  9. Bugzilla 24592: ImportC: Bitfield layout wrong for int64 on 32-bit Linux
  10. Bugzilla 24594: ImportC: Packed struct has wrong layout
  11. Bugzilla 24603: Can copy from non-void array into void[] in safe code
  12. Bugzilla 24622: Modify const data with void[] concatenation/append
  13. Bugzilla 24630: Casting a bool pointer to a mutable pointer type is unsafe
  14. Bugzilla 24631: Pointer cast allows changing @system field in @safe code
  15. Bugzilla 24634: Parse error initializing array from expression with StructInitializer

DMD Compiler enhancements

  1. Bugzilla 20243: inout not substituted for in associative array key type
  2. Bugzilla 24135: Eponymous template member overloads not shown as call candidates
  3. Bugzilla 24580: ImportC: Asm label after attributes results in syntax error
  4. Bugzilla 24598: OpenBSD: adapt compiler tests
  5. Bugzilla 24623: Rename version CppRuntime_Clang/Gcc to CppRuntime_libcxx/libstdcxx.

Phobos bug fixes

  1. Bugzilla 24564: std.file.DirEntry throws Exception instead of FileException

Druntime bug fixes

  1. Bugzilla 24579: stat_t has wrong size for Android armv7a
  2. Bugzilla 24626: hasUDA does not handle multiple UDAs of the same symbol

Druntime enhancements

  1. Bugzilla 24590: Illegal instruction with module constructors cycle and shared libphobos2 in _d_criticalenter2 bug fixes

  1. Bugzilla 24543: The @__future attribute is (almost) undocumented
  2. Bugzilla 24548: [spec] Boolean condition conversion is not documented
  3. Bugzilla 24565: out contract variable is implicitly const

Installer bug fixes

  1. Bugzilla 24600: DMD nightly builds are outdated

Contributors to this release (27)

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

previous version: 2.109.1