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

previous version: 2.102.2 – next version: 2.103.1

Download D 2.103.0
released Apr 01, 2023

2.103.0 comes with 9 major changes and 83 fixed Bugzilla issues. A huge thanks goes to the 43 contributors who made 2.103.0 possible.

List of all bug fixes and enhancements in D 2.103.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)).

Library changes

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

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

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

List of all bug fixes and enhancements in D 2.103.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 23799: Link error with -betterC

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 16098: align(N) not respected for stack variables if N > platform stack alignment
  4. Bugzilla 16213: CTFE internal error with static array $ as template argument
  5. Bugzilla 20781: Can call @live function without checking dip1021 rules
  6. Bugzilla 20908: -preview=nosharedaccess requires zero-initializion for aggregates
  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 23752: ImportC: can't take address of dereferenced void pointer
  36. Bugzilla 23760: Error: unknown
  37. Bugzilla 23763: ICE on operations involving zero-initialized structs
  38. Bugzilla 23767: ImportC: ternary with null constant has wrong pointer type
  39. Bugzilla 23778: Code generator fails to handle __c_complex_real properly for Windows
  40. Bugzilla 23781: [ICE] Segmentation Fault when taking the address of a ref return at CTFE
  41. Bugzilla 23783: -preview=nosharedaccess does not detect comparison of shared data
  42. Bugzilla 23790: Cannot use cas on member variable with -preview=nosharedaccess
  43. Bugzilla 23792: lexer warns about preprocessor inside token strings

DMD Compiler enhancements

  1. Bugzilla 11316: Some cases of missing delegate argument type inference
  2. Bugzilla 13656: clarify error message upon trying to declare a variable of type ref
  3. Bugzilla 16495: __traits(fullyQualifedName) instead of std.traits.fullyQualifiedName
  4. Bugzilla 20101: BetterC: Template instantiation in CTFE only context should skip codegen / nogc / ... Phases
  5. Bugzilla 23558: add __traits(getModuleClasses [, module name])
  6. 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 23474: Grapheme should end after carriage return if not followed by line feed.
  2. Bugzilla 23600: [] formattedRead static asserts with Tuple and compile time format string
  3. Bugzilla 23668: Can't stable sort structs with disabled default constructor.
  4. Bugzilla 23724: HTTP.onReceive example does not compile

Phobos enhancements

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

Druntime bug fixes

  1. Bugzilla 19575: core.cpuid not usable without a runtime
  2. 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 16707: [Templates] run variadic templates example failed
  4. Bugzilla 21132: Ff two keys in an associative array literal are equal
  5. Bugzilla 21178: It is not explained what is "unknown"
  6. 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 (43)

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

previous version: 2.102.2 – next version: 2.103.1