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

previous version: 2.104.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.105.0 comes with 9 major changes and 76 fixed Bugzilla issues. A huge thanks goes to the 36 contributors who made 2.105.0 possible.

Tools changes

  1. rdmd supports -shared

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

Compiler changes

  1. Better error message when attribute inference fails down the call stack

    When a function fails to infer a function attribute, all callers of that function also fail to infer the attribute. The resulting error message only points to the top most function with the explicit attribute:

    void main() @nogc
    {
        fun();
    }
    
    auto fun()
    {
        funImpl();
    }
    
    auto funImpl()
    {
        int[] a = [1, 2, 3];
    }
    

    app.d(4): Error: @nogc function D main cannot call non-@nogc function app.fun
    

    This doesn't tell the underlying reason why fun wasn't inferred @nogc, and led to use of workarounds to get better information. The new error message will point to the function which failed to infer the attribute:

    app.d(4): Error: @nogc function D main cannot call non-@nogc function app.fun
    app.d(7):        which calls app.funImpl
    app.d(14):        which wasn't inferred @nogc because of:
    app.d(14):        array literal in @nogc function app.funImpl may cause a GC allocation
    

    Note: this was already implemented for @safe since 2.101, but it has now been extended to @nogc, nothrow, and pure.

  2. Using ; as an empty statement has been turned into an error

    This has been deprecated since 2.075.0 because it's error prone:

    void main()
    {
        foreach (i; 0 .. 8);
        {
            // Because of the accidental semicolon above,
            // this block statement is executed once.
            // It's not the loop body
        }
    }
    

    It will now result in an error.

    app.d(3): Error: use { } for an empty statement, not ;
    

  3. Using in parameters with non extern(D)/extern(C++) functions is deprecated

    In preparation for enabling -preview=in by default, using in parameters on function that have neither D nor C++ linkage is deprecated. Users can replace instances of in with either const or scope const. Refer to v2.101.0 changelog's for a full rationale.

  4. in ref on parameters has been deprecated in favor of -preview=in

    Using in ref (or ref in) on function parameters will now yield a deprecation. Users are encouraged to remove the ref and compile with -preview=in, which will infer whether the parameter should be passed by reference or value. Users wanting a specific ABI are encouraged to use scope const ref instead. Note that this also applies to auto ref in, which is equivalent to in with -preview=in, but the latter doesn't require the function to be templated.

  5. Throwing qualified objects is now deprecated

    Previously, an immutable, const, inout or shared exception could be thrown and then caught in an unqualified catch (Exception e) clause. That breaks type safety. Throwing a qualified object is now deprecated. This helps to prevent possible mutation of an immutable object in a catch clause.

    The runtime also modifies a thrown object (e.g. to contain a stack trace) which can violate const or immutable objects. Throwing qualified objects has been deprecated for this reason also.

  6. User Defined Attributes now parse Template Arguments

    It was already allowed to put types in UDAs, but the parser would reject basic types written directly, requiring the use of an alias.

    alias Tint = int;
    
    @Tint void f();
    

    Also, simple literals that can appear in template instantiations without brackets (example: foo!"arg") require parentheses when used as an attribute:

    @("my test") unittest
    {
    
    }
    

    Now, arguments that can appear after a template instantiation foo! can also appear after an @ attribute.

    @int void f();
    
    @"my test" unittest
    {
    
    }
    

Library changes

  1. Better static assert messages for std.algorithm.comparison.clamp

    Until now, clamp 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.

  2. std.typecons.Rebindable now supports all types

    Rebindable can now be used to store and rebind values of any type, including immutable struct values.

    To ensure const safety is preserved, the stored values cannot be accessed by reference.

    The implementation used for all previously supported types (classes, interfaces and arrays) is unchanged.

Tools changes

  1. rdmd supports -shared

    rdmd now understands DMD's -shared switch, and sets the default output file name appropriately (.dll, .so, or .dylib depending on the platform), in the same way as -lib.


List of all bug fixes and enhancements in D 2.105.0:

DMD Compiler regression fixes

  1. Bugzilla 22427: betterC: casting an array causes linker error in string comparison.
  2. Bugzilla 23965: [REG2.101.0] Appending deprecated structs in deprecated function causes deprecation message
  3. Bugzilla 23966: [REG2.102] Cannot use traits(getAttributes) with overloaded template
  4. Bugzilla 23978: [REG 2.103.0] ICE: dip1021 memory corruption
  5. Bugzilla 23979: ICE on failed alias this attempt on pointer expression
  6. Bugzilla 24013: [REG 2.103.0] address of a __traits(getOverloads) item is not converted to a delegate anymore
  7. Bugzilla 24018: array concatenation doesn't work with disabled default construction
  8. Bugzilla 24026: ImportC: ICE on nested C initializer 2

DMD Compiler bug fixes

  1. Bugzilla 7184: parse error on *(x)++
  2. Bugzilla 11612: Inconsistent error on negative new array size
  3. Bugzilla 13063: enum is allowed as storage class for functions
  4. Bugzilla 16384: Invariant not called with multiple defined.
  5. Bugzilla 18528: dmd should deduplicate identical errors
  6. Bugzilla 20008: __traits(allMembers) of packages is complete nonsense
  7. Bugzilla 20687: Allow member function address as const initializer
  8. Bugzilla 21025: Segfault for function contract -preview=dip1021
  9. Bugzilla 21415: catch immutable exceptions breaks immutable
  10. Bugzilla 21425: Using va_start twice results in wrong values
  11. Bugzilla 22729: ICE: Invalid array access for invalid interface definition
  12. Bugzilla 23279: Segmentation fault on mixin template + using unknown type
  13. Bugzilla 23719: runnable/test22071.c:22:16: error: ‘abc’ is a pointer; did you mean to use ‘->’?
  14. Bugzilla 23768: ImportC: ICE on nested C initializer
  15. Bugzilla 23857: backend inliner takes too long on recursive function call
  16. Bugzilla 23870: ImportC doesn't accept '' followed by newline, whereas VC does
  17. Bugzilla 23875: ImportC: __attribute__ in a cast doesn't work
  18. Bugzilla 23879: ImportC: Windows system headers use __alignof
  19. Bugzilla 23880: ImportC: __attribute__((vector_size(N))) is not implemented
  20. Bugzilla 23885: [CI] C++ interop tests with g++ fail
  21. Bugzilla 23900: @safe is allowed in inline asm
  22. Bugzilla 23908: confusing nonexistent import hint on cyclic import
  23. Bugzilla 23912: Destructor disables scope inference
  24. Bugzilla 23914: "auto ref" resolution on return value prevented by noreturn (bottom type)
  25. Bugzilla 23935: ImportC: __pragma not allowed between struct and tag name
  26. Bugzilla 23936: ImportC: pragma pack is not working for structs
  27. Bugzilla 23947: If a class overloads a method mixing private and public and the last overload is public, the method is always public.
  28. Bugzilla 23951: "alias this" not properly dereferenced when the object being looked up is a field of a type
  29. Bugzilla 23968: Deprecation not emitted with alias to template function in UFCS
  30. Bugzilla 23982: segfault when printing scope inference failure
  31. Bugzilla 23986: ICE: dip1021 asserts on typeof(null) parameter
  32. Bugzilla 23988: Conditional Exp does not bring enums to correct common type if one leg is const
  33. Bugzilla 24010: Destructor called before end of scope for tuples
  34. Bugzilla 24017: [UFCS] Bypassing nothrow with debug doesn’t work
  35. Bugzilla 24024: cannot pass class this to ref class
  36. Bugzilla 24025: Expressions contained in parentheses should not be assumed to be C casts
  37. Bugzilla 24027: error: instantiated from here: maxElement!("a.a", A[])
  38. Bugzilla 24029: ImportC: symbol name clash on statement expressions

DMD Compiler enhancements

  1. Bugzilla 4663: Wrong 'static' position error message
  2. Bugzilla 15436: Compiler still refers to AliasSeq-s as "tuple"-s (and TypeTuple?)
  3. Bugzilla 23475: confusing printf deprecation message with ulong/long on Windows
  4. Bugzilla 23871: ImportC: __attribute not recognized
  5. Bugzilla 23877: ImportC: Importing byteswap.h results in undefined reference to core.bitop.byteswap
  6. Bugzilla 23886: ImportC preprocessor directive #ident not supported
  7. Bugzilla 23928: improve error msg: scope variable s assigned to non-scope parameter this calling abc
  8. Bugzilla 23931: Error: reference to local variable this calling non-scope member function this.this()
  9. Bugzilla 23948: __FILE__ and __MODULE__ cannot be implicitly converted to const(char)* as default paramenter
  10. Bugzilla 23971: Provide clearer error message when trying to return a slice with C++ linkage
  11. Bugzilla 24000: show the open bracket "{" location for Error: matching } expected, not End of File
  12. Bugzilla 24023: Unnecessary module prefix in error message types

Phobos regression fixes

  1. Bugzilla 23976: std.range.slide fails in dmd-2.104.0
  2. Bugzilla 23993: std.algorithm.maxElement no longer works with array of BigInt

Phobos bug fixes

  1. Bugzilla 23361: std.uni.normalize should be pure
  2. Bugzilla 23844: chain(only) doesn't support immutable structs
  3. Bugzilla 23940: std.getopt does not assert with options that only differ in case with config.caseInsensitive
  4. Bugzilla 23997: isClose(1, -double.infinity) returns true
  5. Bugzilla 24028: BigInt power operator ignores sign of exponent

Phobos enhancements

  1. Bugzilla 23881: std.system has no function for system architecture
  2. Bugzilla 23922: [std.socket]

Druntime regression fixes

  1. Bugzilla 23890: "Warning: cannot inline function" in core.lifetime

Druntime bug fixes

  1. Bugzilla 23312: Crash when calling writeln in WinMain

Druntime enhancements

  1. Bugzilla 23980: OpenBSD: Add getthrname(2) and setthrname(2) to unistd.d
  2. Bugzilla 24044: Support float opCmp(...) with array

dlang.org bug fixes

  1. Bugzilla 23692: ImportC: __pragma and __declspec are not documented as supported Visual C extensions
  2. Bugzilla 23697: No examples of invalid forward references in C code accepted by ImportC
  3. Bugzilla 23946: specifications state that "there can only be one destructor" which can be confusing because of mixin templates

dlang.org enhancements

  1. Bugzilla 5636: Array ops use lexicographic comparison instead of vector-style element-wise
  2. Bugzilla 23571: Discussion of manifest constants in enum documentation is confusing at best

Contributors to this release (36)

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

previous version: 2.104.0