Change Log: 2.110.0
Download D 2.110.0 Beta
to be released Feb 01, 2025
Compiler changes
List of all bug fixes and enhancements in D 2.110.0.
Compiler changes
- 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.
- 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");
- New trait isCOMClass to detect if a type is a COM class
A COM class inherits from a possibly user defined interface called IUnknown. To detect this during compilation use the trait __traits(isCOMClass, Type). Or for during runtime use the TypeInfo_Class flag.
- 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
- 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 regression fixes
- Bugzilla 24431: dmd -vcg-ast crashes printing failed template instantiation
- Bugzilla 24599: [REG2.103] Wrongly elided TypeInfo emission leading to undefined symbols at link-time
- Bugzilla 24687: [REG2.110] Cannot cast string-imports to select overload anymore
- Bugzilla 24699: [REG2.108] No short-circuit evaluation of mixing template bool argument
- Bugzilla 24812: [REG 2.106] Incorrect highlighting when diagnosing an empty enum declaration since #15664
- Bugzilla 24882: COM class is allocated using GC not malloc
DMD Compiler bug fixes
- Bugzilla 10574: "auto ref" fails to match when IFTI succeeds (strip to level const)
- Bugzilla 12885: const union wrongly converts implicitly to mutable
- Bugzilla 17148: Copying from const(void)[] to void[] breaks immutable
- Bugzilla 23722: Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code
- Bugzilla 23957: Casting to derived extern(C++) class is unsafe
- Bugzilla 24337: Segfault when printing an int[] cast from a string literal
- Bugzilla 24534: Having a label on a declaration makes it possible to skip it with goto
- Bugzilla 24558: C asserts segfault on Glibc
- Bugzilla 24577: Struct with constructor returned from C++ wrong
- Bugzilla 24582: Detect unsafe cast(bool[])
- Bugzilla 24583: di generator emits return scope and scope return in wrong order
- Bugzilla 24592: ImportC: Bitfield layout wrong for int64 on 32-bit Linux
- Bugzilla 24594: ImportC: Packed struct has wrong layout
- Bugzilla 24603: Can copy from non-void array into void[] in safe code
- Bugzilla 24622: Modify const data with void[] concatenation/append
- Bugzilla 24630: Casting a bool pointer to a mutable pointer type is unsafe
- Bugzilla 24631: Pointer cast allows changing @system field in @safe code
- Bugzilla 24634: Parse error initializing array from expression with StructInitializer
- Bugzilla 24731: IFTI cannot handle integer expressions
- Bugzilla 24760: ICE on variadic after default argument
- Bugzilla 24764: ICE when -vcg-ast prints imported invariant
- Bugzilla 24790: -vcg-ast ICE on lowered assign exp
- Bugzilla 24819: Optimizer changes result of float calculations on 32-bit
- Bugzilla 24832: Segfault in hex string
- Bugzilla 24884: backend generates wrong 32-bit code after inlining math with double[4]
DMD Compiler enhancements
- Bugzilla 20243: inout not substituted for in associative array key type
- Bugzilla 24135: Eponymous template member overloads not shown as call candidates
- Bugzilla 24580: ImportC: Asm label after attributes results in syntax error
- Bugzilla 24598: OpenBSD: adapt compiler tests
- Bugzilla 24623: Rename version CppRuntime_Clang/Gcc to CppRuntime_libcxx/libstdcxx.
- Bugzilla 24841: UTF-16 surrogates when used as an escape of a string should hint on error
Phobos regression fixes
- Bugzilla 23487: std.experimental.logger assigning FileLogger to sharedLog no longer works
- Bugzilla 24637: [REG 2.104] Cannot insert const/immutable elements into DList
- Bugzilla 24686: SumType stopped working on LDC 1.37 with unmatched DeducedParameterType template
Phobos bug fixes
- Bugzilla 24564: std.file.DirEntry throws Exception instead of FileException
- Bugzilla 24773: Stable sort() invokes the destructor on uninitialized elements
- Bugzilla 24809: In some cases, stable sort assigns to unininitialized elements
- Bugzilla 24824: std.process.browse returns on failure in forked child
- Bugzilla 24827: maxElement does not correctly handle types with opAssign
Druntime bug fixes
- Bugzilla 24579: stat_t has wrong size for Android armv7a
- Bugzilla 24626: hasUDA does not handle multiple UDAs of the same symbol
- Bugzilla 24846: atomicLoad does not work for class arguments with -preview=nosharedaccess
- Bugzilla 24872: Assigning non-copyable value to array has no effect
Druntime enhancements
- Bugzilla 24590: Illegal instruction with module constructors cycle and shared libphobos2 in _d_criticalenter2
dlang.org bug fixes
- Bugzilla 24543: The @__future attribute is (almost) undocumented
- Bugzilla 24548: [spec] Boolean condition conversion is not documented
- Bugzilla 24565: out contract variable is implicitly const
Installer bug fixes
- Bugzilla 24600: DMD nightly builds are outdated
Contributors to this release (34)
A huge thanks goes to all the awesome people who made this release possible.
- 0-v-0
- 0v0
- Alex Muscar
- Andrei Horodniceanu
- Bastiaan Veelo
- Ben Jones
- Brad Roberts
- Brian Callahan
- Connor
- Dennis
- Dennis Korpel
- Emmanuel Nyarko
- Iain Buclaw
- Ilya Yanok
- Jeremy Baxter
- Johan Engelen
- Jonathan M Davis
- Luis Ferreira
- Martin Kinkelin
- Mathias Lang
- Nicholas Wilson
- Nick Treleaven
- Paul Backus
- Quirin F. Schroll
- Quirin Schroll
- Razvan Nitu
- Richard (Rikki) Andrew Cattermole
- RubyTheRoobster
- ryuukk
- Steven Schveighoffer
- Sönke Ludwig
- Tim Schendekehl
- Walter Bright
- zopsicle