Change Log: 2.106.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
Compiler changes
- Assignment-style syntax is now allowed for alias this
- Catch clause must take only const or mutable exceptions
- Functions can no longer have enum storage class
- Overloading extern(C) functions is now an error
- Deprecation phase ended for access to private method when overloaded with public method.
- Added predefined version identifier VisionOS
Runtime changes
Library changes
List of all upcoming bug fixes and enhancements in D 2.106.0.
Compiler changes
- 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; }
- 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 }
- 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() { }
- 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; }
- 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);
- Added predefined version identifier VisionOS
This is Apple's new operating system for their VR/AR device Vision Pro.
Runtime changes
- 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
- 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
- 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.
- 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
- Bugzilla 20655: [REG: 2.072] attribute inference accepts unsafe union access as @safe
- Bugzilla 24066: __traits(isAbstractClass) causes a segfault when passed an opaque class
- Bugzilla 24078: [REG] crash related to concatenation
- Bugzilla 24109: [REG2.103] 'need this' when invoking outer method from inner method
- Bugzilla 24110: [REG2.104] Array comparison lowering apparently not handled properly in __traits(compiles)
- Bugzilla 24118: ICE / regression from 2.103.1 - segfault on CTFE only code in 2.104.2 and 2.105.0
- Bugzilla 24144: [REG2.105] Silent file name index overflow
- Bugzilla 24159: BetterC: appending to dynamic arrays no longer errors at compile time
- Bugzilla 24171: [REG 2.100] Segfault compiling an empty ddoc file
- Bugzilla 24184: [REG 2.103] Segmentation fault accessing variable with align(N) > platform stack alignment
- Bugzilla 24188: ICE (Illegal instruction) with missing imported symbol
DMD Compiler bug fixes
- Bugzilla 8662: Better error for duplicate labels inside static foreach body
- Bugzilla 11455: Overriding template methods should raise a compile error
- Bugzilla 14835: Constant folding should not affect front end flow analysis
- Bugzilla 18578: First enum value assigned 0 instead of EnumBaseType.init
- Bugzilla 19460: C style cast error has wrong line number for functions
- Bugzilla 22682: pragma(mangle) does not work for nested functions
- Bugzilla 23103: static initialization of associative arrays is not implemented
- Bugzilla 23522: Error message when enum type is not integral and a value lacks an initializer
- Bugzilla 23686: template instance reused with default alias arg
- Bugzilla 23733: Can't use template type parameter as type of alias parameter
- Bugzilla 23865: duplicate alias not detected
- Bugzilla 24036: assert message in CTFE becomes ['m', 'e', 's', 's', 'a', 'g', 'e'][0..7] if produced using std.format.format
- Bugzilla 24051: Safety attrib inference of enum/immut/const decls inconsistent with mutable static variable decls
- Bugzilla 24054: return expression expected on noreturn function
- Bugzilla 24055: is(x == __parameters) does not work on function pointer/delegate types
- Bugzilla 24056: const uninitialized data at module scope is not in TLS
- Bugzilla 24065: __traits(getTargetInfo) causes a segfault when passed a non value
- Bugzilla 24070: Opaque struct with nested definition when taking pointer segfaults
- Bugzilla 24071: When enum has typedef integer constants do not have types determined correctly
- Bugzilla 24072: cast(__vector) array literal incorrectly triggers GC error
- Bugzilla 24088: A nested function that returns a tuple that is written with short syntax function does not want to compile.
- Bugzilla 24105: Dip1000 C variadics not marked as scope should not accept scope arguments
- Bugzilla 24107: The error for exceeding the CTFE recursion limit bypasses speculative compilation.
- Bugzilla 24108: dmd -H and -X fail when given an importC module
- Bugzilla 24117: noreturn can be used as expression
- Bugzilla 24121: ImportC: typedef enum fails to compile when generating .di file
- Bugzilla 24129: ImportC: MS-Link cannot handle multiple COMDATs with the same name
- Bugzilla 24130: ImportC: Windows headers use inline asm with different syntax
- Bugzilla 24133: printf format checking of %n allows writing to const pointers
- Bugzilla 24139: 'this' corruption in extern(C++) dtor when destructing via TypeInfo_Struct
- Bugzilla 24154: ImportC: useless expression parsed as invalid variable declaration
- Bugzilla 24156: ImportC: Apple uses __signed as a keyword
- Bugzilla 24168: Corrupted if TLS values are passed in ref parameters when compiling with -fPIE
- Bugzilla 24174: [CTFE] goto within with statements & catch blocks cause a infinite loop
- Bugzilla 24181: reading double parameter from RCX rather than XMM1
- Bugzilla 24187: ImportC: _Float32 not defined
- Bugzilla 24193: Incorrect size of unions with bit fields
- Bugzilla 24199: ImportC: generated .di file uses struct keyword when referring to a type
- Bugzilla 24208: [DIP1000] Scope pointer can escape via non-scope parameter of pure nested function
- Bugzilla 24209: static aa initialization of static function variable ICE
- Bugzilla 24212: [DIP1000] Scope pointer can escape via non-scope parameter of pure virtual function
- Bugzilla 24213: [DIP1000] Scope pointer can escape via non-scope parameter of pure delegate
- Bugzilla 24257: ImportC: ICE on accessing last _Bool bitfield
- Bugzilla 24262: Assert error with bit fields
DMD Compiler enhancements
- Bugzilla 5445: DMD does not look for ".dmd.conf" in HOME dir
- Bugzilla 10532: Silence some unreachable statement warnings when in a static foreach
- Bugzilla 11070: Allow declaration statement in a switch expression
- Bugzilla 15752: Diagnostic: Better Error Message for Assigning Incorrect AA Empty Value
- Bugzilla 20522: Spurious statement unreachable warning caused by undefined variable
- Bugzilla 21520: dmd does not honor the NO_COLOR environment variable
- Bugzilla 21852: diagnostic: One-liner errors with formatted Loc should print context when -verrors=context
- Bugzilla 23958: ImportC: undefined identifier __builtin__sprintf_chk
- Bugzilla 24060: Improve "Cannot create instance of abstract class" error
- Bugzilla 24084: Add -nothrow Switch to Compiler
- Bugzilla 24173: ImportC: add Microsoft iNN integer literal suffixes
Phobos regression fixes
- Bugzilla 24064: Cannot chain() array and immutable Nullable
- Bugzilla 24267: [REG 2.106 beta] Grapheme cannot be used as an AA key
Phobos bug fixes
- Bugzilla 24049: std.conv.to: string to enum conversion is not documented
- Bugzilla 24083: Int128.opCmp's behavior with negative numbers is inconsistent with Int128.opEquals
- Bugzilla 24140: Int128.opBinary [+-*/%&|^] with negative long arguments gives wrong answers
- Bugzilla 24207: std.parallelism: AbstractTask private data is inadvertently available
Phobos enhancements
- Bugzilla 24082: add Int128.toString that supports std.format
- Bugzilla 24142: Allow casting Int128 to integral and floating types
Druntime bug fixes
- Bugzilla 24079: core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer
- Bugzilla 24106: core.stdc.math provides an implementation of modfl for uClibc that only works when real and double are the same size
- Bugzilla 24123: More importc definitions are needed for macOS
- Bugzilla 24230: Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone
dlang.org bug fixes
- Bugzilla 3396: Compiler accepts call of superclass abstract method with no implementation
dlang.org enhancements
- 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.
- Adam D. Ruppe
- Adam Wilson
- Atila Neves
- Basile Burg
- Dante Broggi
- Dennis
- Dennis Korpel
- dkorpel
- Ernesto Castellotti
- H. S. Teoh
- Hiroki Noda
- Iain Buclaw
- Imperatorn
- Jan Jurzitza
- Jeremy
- Jonathan M Davis
- liushuyu
- Mai-Lapyst
- Martin Kinkelin
- Mathis Beer
- mhh
- Nathan Sashihara
- Nicholas Wilson
- Nick Treleaven
- Paul Backus
- Per Nordlöw
- Piotr Fusik
- Prajwal S N
- Razvan Nitu
- Steven Schveighoffer
- Temtaime
- Teodor Dutu
- Tim Schendekehl
- tjs137
- Walter Bright