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

previous version: 2.102.2

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,, 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 and running the pending_changelog target:
    make -f posix.mak pending_changelog

2.104.0 comes with 15 major changes and 91 fixed Bugzilla issues. A huge thanks goes to the 54 contributors who made 2.104.0 possible.

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

Compiler changes

  1. Add __check(assign-expression) to ImportC

    C code normally relies on #include <assert.h> to add support for assert's. D has them builtin to the language, which is much more convenient and does not rely on a preprocessor. This extension adds


    as an expression to ImportC. The compiler switch -checkaction=C gives it the same behavior as C's assert macro. If the compiler switch -release is thrown, the __check's are ignored. The __check expressions are handy for writing C programs that are free of reliance on #include.

    __assert is not used due to conflicts with some C .h files.

  2. Alias this for classes is deprecated

    Using alias this for classes has not been clearly specified and the lookup rules in such circumstances are not defined. As a consequence, various failures or crashes may appear when alias this is used in conjunction with classes. Starting with this release, alias this for classes is being deprecated. As an alternative, getter/setter methods may be used to replace the alias this. This can be generically handled by:

    static foreach(member, __traits(allMembers, LeClass))
        mixin("ref auto " ~ member() { return $field_name." ~ member ~ "; }");
  3. -preview=dip25 has been enabled by default

    Deprecation warnings for DIP25 violations have been enabled since 2.092. Starting with this release, it will report errors, unless the -revert=dip25 switch is used. Using the switch (or its short version -dip25) is now deprecated.

    ref int escapeRef(ref int x) {return x;}
    // Formerly:
    // Deprecation: returning `x` escapes a reference to parameter `x`
    //        perhaps annotate the parameter with `return`
    // Now it is an error, unless `-revert=dip25` is used
  4. export int a; now generates dllexport instead of dllimport

    In order to make it dllimport, use:

    export extern int a;
  5. Deprecate traits(isVirtualFunction) and traits(getVirtualFunctions)

    Up until this release, D had both traits(isVirtualFunction) and traits(isVirtualMethod) (and their coressponding traits(get...) counterpart). The differenrcte between the two is that isVirtualFunction returns true for final methods that do not override anything. This is in contradiction with the D spec which states that final functions that do not override other functions cannot be virtual. isVirtualMethod correctly returns false in that case.

    Starting with this release, both traits(isVirtualFunction) and traits(getVirtualFunctions) are deprecated. If the behavior of traits(isVirtualFunction) is desired, it can be achieved by traits(isVirtualMethod, f) || (traits(isFinalFunction, f) && !traits(isOverrideFunction, f)).

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

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

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

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. Unicode grapheme walking updated to conform to Unicode version 15

    Up until now graphemeStride, byGrapheme and decodeGrapheme functions in std.uni have used obsolete rules from earlier Unicode standards.

    This release brings grapheme breaking rules up to date with Unicode version 15. This means Phobos functions now recognise extended pictogram sequences and prepend characters.

  3. Better static assert messages for std.algorithm.iteration.joiner

    Up until now filter used a template constraint to check if the passed Data could be used. If it were not, it was very tedious to figure out why.

    As the template constraint is not used to overload the symbol template function, the constrains are move into static asserts with expressive error messages.

  4. Better static assert messages for std.algorithm.sorting.sort

    Up until now sort used a template constraint to check if the passed Range could be used. If it were not, it was very tedious to figure out why.

    As the template constraint is not used to overload the symbol template function, the constrains are move into static asserts with expressive error messages.

Dub changes

  1. Add new properties 'cSourcePaths' and 'cImportPaths' to SDL/JSON

    cSourcePaths passes the C source files in all specified directories to the compiler. All C sources found in the given directories for 'cImportPaths' are passed to the D compiler. This ensures backward compatible behaviour for projects that stored C sources aside of D source file, while porting them to D.

    The second keyword 'cImportPaths' will add additional search paths for C headers. These directories are passed to the D compilers as addition include paths. The feature might need additional tweaking, because the include paths are currently joint with the D import paths. This might change in future to support independant search paths for C to be passed to the D compilers.

  2. The --color argument now accepts values auto, never, always

    The previous automatic, on, off values are still supported, but undocumented, because they are used in almost no other program like this. For consistency, with other Linux tools especially, we have implemented and switched the defaults to the widely-used auto, never, always values.

  3. The way packages are stored internally has changed

    Previous versions of dub stored packages in the following format: $CACHE_PATH/$PACKAGE_NAME-$PACKAGE_VERSION/$PACKAGE_NAME/ Starting from this version, the format will be: $CACHE_PATH/$PACKAGE_NAME/$PACKAGE_VERSION/$PACKAGE_NAME.

    Introducing a new level will help users quickly list what packages they actually have installed, and reduce visibility of packages that might update frequently. It will render various commands (e.g. du) more useful, pave the way for a package GC function, and make manual browsing easier.

    More importantly, it will allow future version of dub to infer the version from the path to the package, removing the need to read (or edit) the recipe file on every dub invocation.

List of all bug fixes and enhancements in D 2.104.0:

DMD Compiler regression fixes

  1. Bugzilla 15985: [REG2.068/2.069] Code doesn't link unless compiled with -debug
  2. Bugzilla 18472: [Reg 2.078] betterC: cannot use format at compile time.
  3. Bugzilla 21772: [REG2.069] Consecutive different-signed double.nans in an array literal take the sign of the previous nan (same for float and real)
  4. Bugzilla 22039: ICE on infinite recursion in default parameter
  5. Bugzilla 23688: FTBFS: error: cannot convert 'Expression' to 'Expression*'
  6. Bugzilla 23710: [REG master] Reachable code inside an 'if (false)' block no longer gets codegen
  7. Bugzilla 23758: [REG 2.103] Segfault accessing NewExp::argprefix from C++
  8. Bugzilla 23764: Message printed twice: Usage of in on parameter

DMD Compiler bug fixes

  1. Bugzilla 10886: Typeof on @property function triggers 'wrong this' type error
  2. Bugzilla 11051: Unmatched case in a final switch should throw in both release and non-release mode
  3. Bugzilla 12118: Modify immutable data using throw
  4. Bugzilla 16098: align(N) not respected for stack variables if N > platform stack alignment
  5. Bugzilla 16213: CTFE internal error with static array $ as template argument
  6. Bugzilla 20781: Can call @live function without checking dip1021 rules
  7. Bugzilla 21288: Wrong context pointer for alias this function
  8. Bugzilla 21492: betterC: TypeInfo is generated for code guarded by if(__ctfe)
  9. Bugzilla 21821: Optimizer assumes immutables do not change, but they can in @system code
  10. Bugzilla 22916: [dip1000] copy of ref return still treated as scope variable
  11. Bugzilla 23145: Stack allocation of scope new variables defeats @safe
  12. Bugzilla 23195: Win64 function ABI bug for small non-POD arguments
  13. Bugzilla 23261: druntime core.std.attribute.Tagged1_2 constructor is unsafe
  14. Bugzilla 23387: ImportC: identical structs defined in two C files lead to duplicate .init symbol on macOS
  15. Bugzilla 23407: ImportC: function-local struct definition as part of variable declaration doesn’t shadow global definition
  16. Bugzilla 23545: export int a; should generate dllexport, not dllimport
  17. Bugzilla 23583: ImportC: undefined identifier __builtin___memmove_chk
  18. Bugzilla 23584: ImportC: __builtin_bit_cast not supported
  19. Bugzilla 23598: Circular reference bug with static if and eponymous templates
  20. Bugzilla 23606: betterC with CTFE and gc
  21. Bugzilla 23616: ImportC: clang __has_feature and __has_extension not recognized
  22. Bugzilla 23617: traits(child) compile error need this for something that doesn't need this
  23. Bugzilla 23622: ImportC #defines conflict with declarations
  24. Bugzilla 23635: Nonsensical "case must be a string or an integral constant, not x"
  25. Bugzilla 23639: Casting to shared not allowed with -preview=nosharedaccess
  26. Bugzilla 23650: Using typeid with struct defined in in __traits(compiles, ...) causes linker error
  27. Bugzilla 23651: Order dependency in semantic analysis of template members
  28. Bugzilla 23658: .di generation of variables should turn them into declarations
  29. Bugzilla 23669: [DIP1000] Compound assignment to length of slice member variable in scope method fails
  30. Bugzilla 23676: Static foreach hangs compilation for some time
  31. Bugzilla 23682: dip1000 problem with return by ref
  32. Bugzilla 23694: compilable/ctests2.c:51:9: error: initializer element is not constant
  33. Bugzilla 23711: compilable/testcstuff1.c:63:1: error: invalid use of restrict
  34. Bugzilla 23717: runnable/bitfields.c:192:5: error: unknown type name S; use struct keyword to refer to the type
  35. Bugzilla 23727: ImportC support imaginary real numbers
  36. Bugzilla 23752: ImportC: can't take address of dereferenced void pointer
  37. Bugzilla 23760: Error: unknown
  38. Bugzilla 23763: ICE on operations involving zero-initialized structs
  39. Bugzilla 23767: ImportC: ternary with null constant has wrong pointer type
  40. Bugzilla 23781: [ICE] Segmentation Fault when taking the address of a ref return at CTFE
  41. Bugzilla 23784: ImportC: __ptr32, __ptr64
  42. Bugzilla 23787: ImportC: __unaligned
  43. Bugzilla 23789: ImportC: __declspec(align(n))
  44. Bugzilla 23795: Cannot cast _Complex!double to _Complex!float
  45. Bugzilla 23802: ImportC: __volatile__ is yet another alias for volatile
  46. Bugzilla 23808: #include is not working with importc

DMD Compiler enhancements

  1. Bugzilla 11316: Some cases of missing delegate argument type inference
  2. Bugzilla 13577: More informative error message for refused immutable foreach loop
  3. Bugzilla 13656: clarify error message upon trying to declare a variable of type ref
  4. Bugzilla 16495: __traits(fullyQualifedName) instead of std.traits.fullyQualifiedName
  5. Bugzilla 20101: BetterC: Template instantiation in CTFE only context should skip codegen / nogc / ... Phases
  6. Bugzilla 23558: add __traits(getModuleClasses [, module name])
  7. Bugzilla 23597: .di files not compatible with -i

Phobos regression fixes

  1. Bugzilla 23776: getSymbolsByUDA fails to fetch symbols from module

Phobos bug fixes

  1. Bugzilla 22147: DList can't accept a struct with postblit disabled
  2. Bugzilla 23474: Grapheme should end after carriage return if not followed by line feed.
  3. Bugzilla 23600: [] formattedRead static asserts with Tuple and compile time format string
  4. Bugzilla 23668: Can't stable sort structs with disabled default constructor.
  5. Bugzilla 23724: HTTP.onReceive example does not compile

Phobos enhancements

  1. Bugzilla 6106: Keep track of changes during replace function
  2. Bugzilla 19567: [std.stdio] Not really helpful documentation of tell
  3. Bugzilla 20397: [std.algorithm] documentation nthPermutation
  4. Bugzilla 23683: std.file.setTimes requests more permissions than needed
  5. Bugzilla 23706: Do not escape POSIX shell parameters unless necessary

Druntime bug fixes

  1. Bugzilla 14891: profilegc_setlogfilename w/o null-terminated string might fail during fopen
  2. Bugzilla 19575: core.cpuid not usable without a runtime
  3. Bugzilla 23625: Function ZeroMemory missing in windows headers bug fixes

  1. Bugzilla 6583: cast() operation not fully specified
  2. Bugzilla 11493: incorrectly says that you can't cast from -1 to unsigned types
  3. Bugzilla 14932: The language specification does not define what the shared attribute does
  4. Bugzilla 16707: [Templates] run variadic templates example failed
  5. Bugzilla 21132: Ff two keys in an associative array literal are equal
  6. Bugzilla 21178: It is not explained what is "unknown"
  7. Bugzilla 23716: ImportC: Missing documentation on the asm keyword accepted as an extension enhancements

  1. Bugzilla 18765: [Arrays] Docs need info on initialization of static array with element literal
  2. Bugzilla 20997: Missing example of scope guard executing after return statement
  3. Bugzilla 22418: Error in documentation on strings
  4. Bugzilla 22594: Update "Interfacing to C" to include intptr_t and uintptr_t
  5. Bugzilla 23612: Template constraints article not listed in article index
  6. Bugzilla 23636: No spec docs for shared qualifer
  7. Bugzilla 23730: Clarify IsExpression Identifier : and == TypeCtor spec

Tools bug fixes

  1. Bugzilla 23624: Race condition in test runner for DMD
  2. Bugzilla 23634: Possible data race with runnable example tester

Contributors to this release (54)

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

previous version: 2.102.2