Change Log: 2.084.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
- Add CppRuntime_* version identifiers.
- Deprecated CLI switch -gc have been removed
- Expose __traits(isZeroInit, T)
- Implement new C++ mangling syntax
- Add pragma(linkerDirective), to emit linker directives into object files.
- fix Issue 14246 - RAII - proper destruction of partially constructed objects
- Add __traits(getTargetInfo, "key") to query details about the compilation target.
Library changes
List of all upcoming bug fixes and enhancements in D 2.084.0.
Compiler changes
- Add CppRuntime_* version identifiers.
In order to link against C++ code, it is important to know what C++ runtime the ABI targets.
Supported version identifiers include:
- CppRuntime_Clang
- CppRuntime_DigitalMars
- CppRuntime_Gcc
- CppRuntime_Microsoft
- CppRuntime_Sun
- Deprecated CLI switch -gc have been removed
This switch was deprecated in v2.075.0 and is now removed, meaning DMD will complain about an unrecognized switch. -gc used to pretend to be C, but debuggers have been D-aware for around a decade.
- Expose __traits(isZeroInit, T)
Takes one argument which must be a type. If the type's default initializer has no non-zero bits then true is returned, otherwise false. isZeroInit will always return true for a class C because C.init is a null reference.
This property was already being computed internally by the compiler so exposing it via __traits is more efficient than re-implementing it in library code.
struct S1 { int x; } struct S2 { int x = -1; } static assert(__traits(isZeroInit, S1)); static assert(!__traits(isZeroInit, S2)); void test() { int x = 3; static assert(__traits(isZeroInit, typeof(x))); }
- Implement new C++ mangling syntax
The new syntax allows for keywords to be used for mangling and only changes the mangle of a symbol. It does not provide any feature resembling C++ namespaces. This allows users to structure their C++ in traditional D fashion, utilizing modules. The old syntax extern(C++, foo) would occupy the symbol foo. This meant modules couldn't use this name and match the C++ namespace.
extern(C++, "__traits") void foo(); extern(C++, "std", "chrono") void bar(); // multiple namespace syntax int std; // no symbol clashing with above extern(C++, "std", ...)
- Add pragma(linkerDirective), to emit linker directives into object files.
Emits a custom linker directive to the object file, eg:
pragma(linkerDirective, "/alternatename:_pWeakValue=_pDefaultWeakValue");
This is only supported for MS-COFF output.
- fix Issue 14246 - RAII - proper destruction of partially constructed objects
Since destructors for object fields can now get called by the constructor for that object if the constructor fails, the attributes of the destructors must be covariant with the attributes for the constructor.
I.e. if the constructor is marked @safe, the fields' destructors must also be @safe or @trusted.
Since this behavior was never checked before, this fix causes breakage of existing code. Hence, enabling this behavior is behind the new transition=dtorfields compiler switch. It will eventually become the default behavior, so it is recommended to fix any of these destructor attribute issues.
- Add __traits(getTargetInfo, "key") to query details about the compilation target.
getTargetInfo accepts a string key as argument to select the target detail of interest.
static if (__traits(getTargetInfo, "cppRuntimeLibrary") == "msvcrtd") { ... } static assert (__traits(getTargetInfo, "not_a_target_info") == "??"); // <- error: no such targetInfo "not_a_target_info"!
getTargetInfo keys are implementation defined, allowing relevant data for exotic targets. A reliable subset which are always available shall be mentioned in the spec.
Library changes
- std.algorithm.iteration.each is now capable of early-stopping
std.algorithm.iteration.each is now capable of exiting early. When a No.each std.typecons.Flag is returned from the function that is called by each, the iteration will be aborted early. Analogously, returning Yes.each will continue the iteration. For example:
auto arr = [10, 20, 30]; arr.each!((n) { arr ~= n; return (n == 20) ? No.each : Yes.each; }); // aborts after the second iteration assert(arr == [10, 20, 30, 10, 20]);
- toHash function has been added to std.experimental.checkedint.Checked
Custom hashing can be implemented in a Hook. If no hashing is specified, then the built-in function will be used. Checked can now be used with associative arrays.
import std.experimental.checkedint; static struct MyHook { static size_t hookToHash(T)(T payload) { auto h = typeid(payload).getHash(&payload); return h + 0x9e3779b9 + (h << 6) + (h >> 2); } } auto h = checked!MyHook(142).toHash();
List of all bug fixes and enhancements in D 2.084.0:
DMD Compiler regressions
- Bugzilla 15206: [REG2.077] ICE on optimized build, tym = x1d Internal error: backend\cgxmm.c 547
- Bugzilla 16284: [REG2.067] CTFE internal error: bad compare
- Bugzilla 18938: Dmd segfault when compiling this dub package in test release
- Bugzilla 19103: Can imports symbols in module to a struct with mixin.
- Bugzilla 19202: deprecated eponymous template prints no warning
- Bugzilla 19227: S.init is S.init failing for struct with float member
- Bugzilla 19337: [Reg 2.082.0] Cannot call std.algorithm.sort twice
- Bugzilla 19389: Multiple assignment does not work for struct members
- Bugzilla 19409: static if (__traits(compiles, __traits(identifier, ...))) evaluates to false even though the expression alone evaluates to true
- Bugzilla 19419: [REG2.080.1] @disabled this() will print wrong error if calling non-default constructor with wrong parameters
- Bugzilla 19447: [REG2.066] fixed size slice assignment in ctfe loses connection with array
- Bugzilla 19473: DMD Segfault on circular struct reference
- Bugzilla 19491: ICE (segfault) when initializing scope variable with shared type
- Bugzilla 19510: [2.084 REG] random and spurious error about a missing NOLOGO.d file
DMD Compiler bugs
- Bugzilla 5973: alias this is not considered with superclass lookup
- Bugzilla 6777: alias this disables casting for classes
- Bugzilla 9274: is + alias this = wrong code
- Bugzilla 10692: Deprecation isn't checked using alias this
- Bugzilla 11499: is-expression misbehaving with 'alias this'
- Bugzilla 13392: class + alias this + cast(void*) == overzealous cast
- Bugzilla 13953: AA .remove pseudo-method doesn't work via alias this
- Bugzilla 14632: Diagnostic improvement for invalid cast with alias this
- Bugzilla 15876: various cases of SEGFAULT when formatting parser errors
- Bugzilla 16082: Can't access alias this member with same name as module
- Bugzilla 16086: Imported function name shadows alias this member
- Bugzilla 16479: Missing substitution while mangling C++ template parameter for functions
- Bugzilla 16633: Case where an alias this is tried before the object itself
- Bugzilla 16976: Implicit conversion from ulong to int in foreach_reverse
- Bugzilla 18010: Undefined reference to _d_arraycopy when copying arrays in -betterC
- Bugzilla 18456: crt_constructor/crt_destructor segfaults if -lib
- Bugzilla 18572: AliasSeq default arguments are broken
- Bugzilla 18979: Template constructor bypasses private
- Bugzilla 19014: Compiler imports symbols that aren't actually imported.
- Bugzilla 19086: Bad stack trace for exceptions
- Bugzilla 19163: static/tuple foreach counted incorrectly in coverage analysis
- Bugzilla 19307: Variables moved to a closure show nonsense in debugger
- Bugzilla 19318: Variables captured from outer functions not visible in debugger
- Bugzilla 19319: No line number when std.math is missing for x ^^ y
- Bugzilla 19336: [ICE] segfault on invalid code
- Bugzilla 19376: Do not generate object file from .di file passed on command line
- Bugzilla 19381: capture pointer in nested function should not be called "this"
- Bugzilla 19393: Structure dtor isn't called after passed to T[]... argument. Memory leaks issue
- Bugzilla 19415: return non-copyable struct fails if member function has return attribute
- Bugzilla 19464: typeof immutable fields order dependent
- Bugzilla 19497: the program crash using dmd with -O, it works fine without optimizations.
- Bugzilla 19520: assert(TypeExp is TypeExp): compiles with empty structs
DMD Compiler enhancements
- Bugzilla 1870: Reproduce offending lines in error messages for string mixins
- Bugzilla 7804: Cannot alias __traits directly
- Bugzilla 12790: Compiler should keep mixin file around for debugging purposes
- Bugzilla 16165: Show expected number of function arguments on mismatch
- Bugzilla 19246: Binary literal 0b_ allowed
- Bugzilla 19278: extern(C++, "name") doesn't accept expressions
- Bugzilla 19439: Make __traits(getAliasThis) return empty tuple for non-aggregate types
Phobos regressions
- Bugzilla 13300: pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit'
- Bugzilla 18824: [REG 2.080] Tuple's opBinaryRight takes precedence over appending a tuple to an array of tuples
- Bugzilla 19133: core.exception.rangeerror@std/file.d(3812):
- Bugzilla 19213: goto skips declaration of variable in std.algorithm.iteration.joiner
- Bugzilla 19444: hasRawAliasing loops on class with static array, cannot swap class refs
Phobos bugs
- Bugzilla 4957: std.concurrency does not allow to pass Tid in struct fields
- Bugzilla 18327: std.random.XorshiftEngine is parameterized by UIntType but only works with uint
- Bugzilla 18680: std.random.LinearCongruentialEngine has opEquals but no toHash
- Bugzilla 18755: std.typecons.Rebindable breaks @safe-ty
- Bugzilla 18778: std.format: Positional arguments do not work as expected with nesting
- Bugzilla 18796: std.algorithm.substitute asserts on empty range
- Bugzilla 19331: std.regex.internal.ir.SmallFixedArray.toHash is ignored because it's non-const
- Bugzilla 19338: std.bitmanip.BitArray.count gives segfault for empy BitArray
- Bugzilla 19366: Qualify opCast(bool) as const for findSplit, findSplitBefore and findSplitAfter
- Bugzilla 19367: std.net.curl does not understand HTTP/2 status lines
- Bugzilla 19456: ParameterIdentifierTuple incorrect for abstract methods with unnamed parameters
Phobos enhancements
- Bugzilla 5502: More handy ways to create associative arrays
- Bugzilla 9702: std.string.replace for single chars too?
- Bugzilla 10930: std.array.replace cannot simple replace an element in array
- Bugzilla 18595: std.random: add unpredictableSeedOf!UIntType for non-uint unpredictableSeed
- Bugzilla 19164: malloc may be considered pure when failure results in program exit (no need to reset errno)
- Bugzilla 19197: Replace instances of typeid(T).getHash(..) with hashOf
- Bugzilla 19238: no-arg splitter should work on ranges of characters
- Bugzilla 19308: Optimize std.string.stripLeft
- Bugzilla 19364: Decrease template bloat for string functions
- Bugzilla 19396: [betterC] ScopeBuffer can't be used in betterC with inline
- Bugzilla 19403: Make std.string.stripLeft on char array @nogc nothrow
- Bugzilla 19404: Optimize std.string.stripRight
- Bugzilla 19405: Speed up backwards UTF-8 decoding in stripRight & make nogc nothrow for strings
- Bugzilla 19429: indexOf("a", "b") should be nothrow/@nogc
- Bugzilla 19466: functionLinkage documentation omits some values
Druntime regressions
- Bugzilla 19498: undefined identifier rt_loadLibraryW
Druntime bugs
- Bugzilla 8872: Missing extended window styles (WS_EX_... enumeration) in windows header
- Bugzilla 11168: core.stdc.time.asctime() is incorrectly marked as @trusted
- Bugzilla 11174: Both AF_PACKET and SO_BINDTODEVICE undefined
- Bugzilla 11294: Object destruction with alias this
- Bugzilla 19087: final switch cannot be used in -betterC
- Bugzilla 19090: core.internal.hash.bytesHash unit test uses incorrect test vector on BigEndian machines
- Bugzilla 19204: hashOf doesn't accept SIMD vectors
- Bugzilla 19332: hashOf fails to compile for const struct that has non-const toHash & has all fields bitwise-hashable
- Bugzilla 19401: Fix bug in core.internal.traits.hasElaborateDestructor & hasElaborateCopyConstructor for struct with static array alias & for nested structs/unions
- Bugzilla 19433: Don't consume --DRT-* options if rt_cmdline_enabled is false
Druntime enhancements
- Bugzilla 19214: Support object.destruct() for efficient (and correct!) destruction
- Bugzilla 19398: Document meaning of core.atomic.MemoryOrder
- Bugzilla 19414: object.__cmp(T[]) on big-endian architectures can use memcmp for unsigned integers of any size
- Bugzilla 19416: Make core.exception.onOutOfMemoryError work in betterC
- Bugzilla 19421: Make pureMalloc, etc. usable in BetterC
- Bugzilla 19423: In core.stdc.errno directly link __errno on OpenBSD & NetBSD
- Bugzilla 19424: Add Haiku support to core.stdc.errno
- Bugzilla 19468: Improve cyclic dependency error message
dlang.org bugs
- Bugzilla 19374: TypeVector undefined in grammar
dlang.org enhancements
- Bugzilla 19321: Unions "may not" have fields with destructors
Installer bugs
- Bugzilla 19434: "Invalid signature" when using install.sh with no ~/.gnupg
Contributors to this release (54)
A huge thanks goes to all the awesome people who made this release possible.
- aG0aep6G
- Andrei Alexandrescu
- Andu033
- ARaspiK
- Arun Chandrasekaran
- Basile Burg
- BBasile
- Chris
- David Gileadi
- Diederik de Groot
- dukc
- Eduard Staniloiu
- FeepingCreature
- H. S. Teoh
- HANATANI Takuma
- Iain Buclaw
- Jacob Carlborg
- jmh530
- Joakim Noah
- Johan Engelen
- Johannes Pfau
- jsatellite
- kinke
- Laurent Tréguier
- look-at-me
- Manu Evans
- Martin Nowak
- Mathias Lang
- Mathis Beer
- Mike Franklin
- Mike Parker
- Nathan Sashihara
- Nicholas Lindsay Wilson
- Nicholas Wilson
- Nick Treleaven
- Oleksandr Palamar
- Paul Backus
- Per Nordlöw
- Petar Kirov
- Pharap
- Rainer Schuetze
- Razvan Nitu
- Richard Palme
- Robert burner Schadek
- Roman Chistokhodov
- rracariu
- Sebastian Wilzbach
- Simen Kjærås
- Stanislav Blinov
- Steven Schveighoffer
- Thomas Mader
- Vladimir Panteleev
- Walter Bright
- wolframw