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

previous version: 2.096.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.097.0 comes with 18 major changes and 158 fixed Bugzilla issues. A huge thanks goes to the 57 contributors who made 2.097.0 possible.

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

Compiler changes

  1. D ABI change on x86_64 Posix targets

    The compiler has been updated to return the real part of creal numbers in ST0, and the imaginary part in ST1, to match the x86_64 System V ABI.

    This is an ABI breaking change and requires recompiling libraries that make use of the creal type.

  2. Added __c_complex_float, __c_complex_double, and __c_complex_real types

    This allows code interfacing with C and C++ to maintain ABI compatibility with _Complex types. It replaces the built-in types cfloat, cdouble, and creal which are due to be deprecated.

  3. Having both a copy constructor and a generated postblit is now deprecated

    Up until this release, the postblit had priority over the copy constructor, no matter if the former was user-defined or generated. This prevented new code that uses the copy constructor to interact with library code that uses the postblit. To enable this interaction, having a generated postblit and a copy constructor (user-defined or generated) is now deprecated. For example:

    // library code using postblit
    struct A
    {
        this(this) {}
    }
    
    // new code using copy constructor
    struct B
    {
        A a;
        this(const scope ref B) {}
    }
    

    Up until this release, in the above code, struct B had a generated postblit that had priority over the user defined copy constructor. With this release, a deprecation will be issued at the definition of structB, stating that the postblit is going to be preferred to the copy constructor. If B has both a user-defined postblit and a copy constructor (generated or user-defined), the postblit will continue to have priority.

    To get rid of the deprecation, the user can either:

    1. Explicitly @disable this(this) in struct B. That will instruct
    the compiler that the copy constructor is preferred over the postblit.

    1. Define a postblit for struct B. That will instruct the compiler
    that the postblit is preferred over the postblit.

    1. Remove all copy constructors from struct B. In this case the postblit
    will be used for copy constructing instances of struct B.

  4. DMD's JSON output will now always include the protection level

    In previous release, the JSON output the compiler generates did not include the protection level if it was public. It is now always included.

  5. DMD's JSON output now have distinct types for [shared] module constructor/destructor

    Previously, module constructors and destructors (shared or not) would be output as functions, and the only way for documentation generators to recognize them was to search for the pattern that was used for their naming. This means that external tools would need to depend on internal compiler details for generating documentation. From this release, 4 new values have been introduced for kind: shared static constructor, shared static destructor, static constructor, static destructor.

  6. Deprecate local templates that receive local symbols by alias

    Support for instantiating local and member templates with local symbols was implemented in DMD 2.087.0. However, the implementation was incompatible with GDC and LDC backends.

    In order to maintain feature parity among D implementations, this improvement has been deprecated, and may be removed from a future DMD release.

  7. Improvements for the C++ header generation

    The following features/bugfixes/improvements were implemented for the experimental C++ header generator:

    • Generate fieldwise constructors for aggregates
    • Don't emit instantiated classes as unique class declarations
    • Emit template arguments for instantiated base classes
    • Don't emit enums for opaque types specially handled by the compiler

    Note: The header generator is still considerer experimental, so please submit any bugs encountered to the bug tracker.

  8. Add -gdwarf=<version> switch for the DMD compiler.

    Emit DWARF symbolic debug info (non-Windows machines only). Supported versions are 3, 4, and 5.

    Once added, the -g switch is implicitly activated.

    Note: DWARF Version 5 is experimental.

  9. Introduced __traits(getVisibility, Sym) as an alias to getProtection

    Since the changes in v2.071.0, attributes such as private, protected, public, etc... are visibility attributes, and not protection attributes. However, the name of this trait predates such change and was thus inconsistent with all the other documentation. This change only introduce the new name, and getProtection has been left un-deprecated, and while using the new name is reccommended for users that only supports the latest version of the language, there is no plan to deprecate it.

  10. Plain synchronized statements now use run-time allocated mutexes.

    Synchronized statements have two forms, synchronized and synchronized(exp). When there is no expression argument, a global mutex is created using a static buffer big enough to store the platform dependant critical section type and a pointer field.

    Example:

    void main()
    {
        synchronized {
            // __gshared byte[40 + 8] __critsec;
            // _d_criticalenter(&__critsec[0]);
            // scope(exit) _d_criticalexit(&__critsec[0]);
            (cast() counter) += 1;
        }
    }
    

    This implementation suffers from a couple deficiencies. Neither the size nor alignment of the critsec buffer are obtained from the OS critical section type defined in druntime. As a result, if the size allocated by the compiler is too small, or the platform has strict alignment requirements, then the program run-time will crash on entering the synchronized statement.

    This code will now call a new implementation that allocates the critical section lazily at run-time, moving all logic out of the compiler to druntime.

  11. Allow shortened function implementations for single-expresssion functions.

    -preview=shortenedMethods is added. This allows functions to be written in a similar form to lambda functions:

    // these 2 are equivalent
    int foo() { return 1; }
    int foo() => 1;
    

    The syntax allows the form => expr to replace the function body { return expr; }

Runtime changes

  1. The druntime option callStructDtorsDuringGC has been removed

    It had been deprecated in 2.088.

  2. FreeBSD declarations from statvfs that belong in mount have been removed

    It had been deprecated in 2.082 in favor of core.sys.freebsd.sys.mount.

  3. Experimental llvm-libunwind based backtrace printing was added

    Currently, druntime uses the backtrace and backtrace_symbols functions to provide debug informations (addresses and function names, respectively).

    This can create issues for target that do not provide backtrace, such as Musl libc. Additionally, the backtrace interface is inherently limited, as it only allow to get up to X frames (where X is the size of the buffer), and forces them to be stored continuously in memory. The same apply to backtrace_symbols.

    On the other hand, libunwind is an industry standard for unwinding and stack trace inspection. It has been ported to a variety of platform, has a simple yet flexible API, and is part of GCC, and a similar library is part of LLVM.

    Starting from this release, druntime includes a way to use LLVM's libunwind as a backtrace provider. The support is limited to LLVM's version of libunwind, as it is available on Alpine Linux, and easier to interface with.

    For packagers, one can define DRuntime_Use_Libunwind when building druntime, enabling the support by default.

Library changes

  1. Deprecate std.math : approxEqual

    The template approxEqual for comparing floating point numbers has been deprecated.

    Please use the template isClose instead, which has better default values and is symmetric in its arguments.

    To (almost) keep the current behaviour of approxEqual(a, b) use isClose(a, b, 1e-2, 1e-2), but we recommend to adjust the code to make it work with isClose(a, b).

Dub changes

  1. Builds dynamicLibrary targets as dynamic libraries instead of static libraries.

    Dub will no longer build dynamicLibrary targetType's as staticLibrary.

    Except for x86_omf. This has been disabled due to numerous issues that will lead this to not doing what is expected of it.

    No compiler or linker flags have been added at this time, you will need to specify the relevant flag to get the compiler to link dynamically against Phobos.

  2. The $DUB_BUILD_PATH variable was added

    The $DUB_BUILD_PATH variable is now defined inside the postBuildCommands section. It contains the absolute path in which the package was built, and can be used to copy by-products of the build process to their intended locations.

    For example, if an executable exports symbols, you will want to make the resulting import library and symbols export file available somewhere. That can be done with a dub.json section like this:

        "postBuildCommands-windows": [
            "copy /y $DUB_BUILD_PATH\\$DUB_TARGET_NAME.lib $PACKAGE_DIR\\lib"
            "copy /y $DUB_BUILD_PATH\\$DUB_TARGET_NAME.exp $PACKAGE_DIR\\lib"
        ],
    
  3. Command environment variable substitution changed

    Now users can use the documented predefined variables inside custom command directives without the need for a wrapper shell script.

    Before this would have failed:

    "preBuildCommands": ["$DC -run foo.d"]
    

    unless DC was defined as environment variable outside DUB.

    It was before possible to run a script that used the $DC environment variable or on POSIX escape the $ with $$DC to make the shell substitute the variable. These workarounds are no longer needed now.

    API change: none of the different command directives are no longer substituted with the process environment variables. You now access the raw commands as provided by the user in the recipe. dub describe has been adjusted and now also processes the predefined environment variables as well as the process environment variables.


List of all bug fixes and enhancements in D 2.097.0:

DMD Compiler regression fixes

  1. Bugzilla 21229: [REG 2.080.2] Constructor flow analysis doesn't understand unions
  2. Bugzilla 21687: Confusing error message for CTFE pointer in static initializer
  3. Bugzilla 21752: Template constraint breaks nested eponymeous template
  4. Bugzilla 21798: checkaction=context creates temporary of type void
  5. Bugzilla 21802: opAssign and opOpAssign treat lazy void parameters inconsistently
  6. Bugzilla 21806: Overload selection ignores slice
  7. Bugzilla 21880: [REG 2.095] scope variable assigned to non-scope parameter calling function
  8. Bugzilla 21898: Qualifier ignored in alias definition if parentheses are not present
  9. Bugzilla 21914: naked assembler functions get wrong offset to parameters
  10. Bugzilla 21936: [REG 2.080.1] Segfault when compiled with -dip1000

DMD Compiler bug fixes

  1. Bugzilla 2450: Error using operators from named template mixin
  2. Bugzilla 13815: Inconsistent goto jump behavior between compile-time and runtime
  3. Bugzilla 14114: Allow volatileLoad/Store to access null location
  4. Bugzilla 14740: __traits(allMembers) returns erroneous 'this' member for types declared in functions.
  5. Bugzilla 14954: extern opaque struct instance doesn't compile
  6. Bugzilla 15478: cases of missed CTFE evaluation when defining arrays dimensions
  7. Bugzilla 16472: Spurious "is used as a type" when aliasing enum template as default parameter
  8. Bugzilla 17146: Internal error: tk.c 266 with -O -inline
  9. Bugzilla 18251: deprecate + transition=complex shouldn't look at functions with non-matching if constraints
  10. Bugzilla 19192: [wrong-code] [crashes] Covariant method interface <- abstract class <- class hierarchies
  11. Bugzilla 19387: [dip1000] __fieldPostblit should be scope or deduce scope qualifier
  12. Bugzilla 19443: core.simd generates MOVLPS instead of MOVHLPS
  13. Bugzilla 19783: Fail to emplace struct with betterC
  14. Bugzilla 20460: [OSX] DMD writes the same address everywhere in DWARF debug infos
  15. Bugzilla 20581: DIP1000 wrongly flags hidden ref temporary
  16. Bugzilla 20599: cpp_long as enum type doesn't work
  17. Bugzilla 20704: -preview=rvaluerefparam does not work with init as default parameter
  18. Bugzilla 20705: -preview=rvaluerefparam does not work with template deduction
  19. Bugzilla 20855: stack overflow when compiling large file
  20. Bugzilla 21403: dmd/backend/cgcs.d:375 assert failed
  21. Bugzilla 21651: Unimported package doesn't error out when used as part of fully qualified type
  22. Bugzilla 21661: Can't use fully-qualified name of the current module inside an expression
  23. Bugzilla 21665: Void initialization should not be allowed for instances of struct with invariant
  24. Bugzilla 21668: Cannot declare ref parameter of opaque type
  25. Bugzilla 21672: [REG][ICE][SIMD] accessing SIMD type as a short causes compiler ice
  26. Bugzilla 21680: inconsistent error on typeof({ return field; }())
  27. Bugzilla 21684: Assert fail for Win32 with a struct larger than 64k in size
  28. Bugzilla 21699: Duplicate error for index out of bounds at compile time
  29. Bugzilla 21726: Wrong comparison in package(...) visibilities
  30. Bugzilla 21739: debug case can access variable from other case
  31. Bugzilla 21742: dot template expressions don't have the void type like any template
  32. Bugzilla 21743: getOverloads fails to propagate 'this' expression for template member
  33. Bugzilla 21753: Struct literal with function literal member not allowed as template value argument
  34. Bugzilla 21765: Assignment-as-condition error with checkaction=context
  35. Bugzilla 21779: assert not omitted for -release -checkaction=context
  36. Bugzilla 21785: Cannot declare variable of opaque enum with base type
  37. Bugzilla 21791: Stack overflow for forward-referenced enum initializer
  38. Bugzilla 21792: Enum using itself as base type crashes dmd
  39. Bugzilla 21793: Cannot initialize shared member with -preview=nosharedaccess
  40. Bugzilla 21797: Stack overflow for forward-referenced enum min / max
  41. Bugzilla 21799: CTFE doesn't call base class destructor for extern(D) classes
  42. Bugzilla 21812: __traits(allMembers) on types with value tuples return ghost members
  43. Bugzilla 21816: testing XMM for nan does not work
  44. Bugzilla 21822: Optimizer flowlv() does not account for OPmemcmp and OPstrcmp
  45. Bugzilla 21825: DIP1034: Do not spuriously warn "calling XXX without side effects discards return value of type 'noreturn'"
  46. Bugzilla 21826: MSCOFF output for Win32 should not use EBP for anything other than the frame pointer
  47. Bugzilla 21827: Null pointer exception in elToPair() in backend/cgelem.d
  48. Bugzilla 21828: Enum forward-references just assume int base type
  49. Bugzilla 21830: Wrong deprecation message when non-deprecated template in static condition
  50. Bugzilla 21831: Wrong deprecation message in template parameters before evaluating constraints
  51. Bugzilla 21832: Wrong deprecation message when importing non-deprecated template in static condition
  52. Bugzilla 21833: Optimizer incorrectly rewrites integer comparison to unsigned short comparison
  53. Bugzilla 21849: UTF8: -verrors=context doesn't respect multibyte characters
  54. Bugzilla 21861: ctfe fails when a nested enum or function has a UDA
  55. Bugzilla 21870: Property/method not invoked and requires () when used in static array length
  56. Bugzilla 21874: The test suite fails with most recent GDB versions
  57. Bugzilla 21876: Zero-length static arrays "cannot be read at compile time"
  58. Bugzilla 21878: "ref" lost when indexing array in CTFE
  59. Bugzilla 21882: [ICE][dip1021] src/dmd/escape.d(1850): Assertion failure
  60. Bugzilla 21883: poor error message when swapping order of base class and interface
  61. Bugzilla 21918: segfault in getParameterStorageClasses on auto function with error
  62. Bugzilla 21927: ICE (illegal instruction) with static foreach over empty member template
  63. Bugzilla 21940: Compiler flags -check=on/off not recognized

DMD Compiler enhancements

  1. Bugzilla 16140: while(auto x = y) does not behave like if(auto x = y)
  2. Bugzilla 20068: Union initialization in constructors should be @safe
  3. Bugzilla 21203: Accept pragma(mangle) on aggregate types
  4. Bugzilla 21585: add __traits(totype, string) to convert mangled type string to an existing type
  5. Bugzilla 21630: assert(0) and assert(false) should not be marked for coverage
  6. Bugzilla 21835: Operation on float should use XMM register, not x87
  7. Bugzilla 21845: Wrong ParameterStorageClass when -preview=in is used

Phobos regression fixes

  1. Bugzilla 20886: std.process.browse does not work with URLs 256 characters or longer
  2. Bugzilla 21716: std.regex performance regression (additional GC allocation)
  3. Bugzilla 21725: Specifying null as bitfields variable name now fails

Phobos bug fixes

  1. Bugzilla 8424: Compile time conversions of double/floats to strings
  2. Bugzilla 9297: Formatting of floating point values in std.format truncates reals to double
  3. Bugzilla 15227: std.format undocumented grammar
  4. Bugzilla 15348: std.stdio.writef format specifier error message
  5. Bugzilla 15386: std.format.formatValue usage hangs
  6. Bugzilla 15888: std.format should not produce deprecated hexstrings
  7. Bugzilla 16432: JSON incorrectly parses to string
  8. Bugzilla 17381: Checked format string is permissive after floating point argument
  9. Bugzilla 18780: Inconsistent behavior with Variant holding int converting to unsigned types
  10. Bugzilla 20320: format("%f") leeds to wrong output
  11. Bugzilla 20371: std.format limited to 500 characters for floats
  12. Bugzilla 20502: Converting std.typecons.RefCounted!T to a string gives T's storage location instead of T's fields when T is a struct without an explicit toString
  13. Bugzilla 20534: std.format: %r on boolean gives wrong result
  14. Bugzilla 20536: std.format: %a on reals is inconsistent with %a on float/double
  15. Bugzilla 21456: std.format does not accept enum member with string base type as template parameter
  16. Bugzilla 21512: RedBlackTree!Tid treats any values as duplicated except for Tid.init
  17. Bugzilla 21575: Child processes spawned by std.process.spawnProcess accidentally inherit signal masks in parent process
  18. Bugzilla 21592: two stack traces if high surrogate is printed
  19. Bugzilla 21601: std.math : pow(float/double, -2) produces sometimes wrong result
  20. Bugzilla 21627: macOS: std.stdio.File.sync does not guarantee to be written to disk
  21. Bugzilla 21641: std.format: %g produces in rare circumstances inconsistent result
  22. Bugzilla 21679: Assertion failure in Base64.encoder for empty input range of ranges
  23. Bugzilla 21700: Long deprecated Stopwatch std.datetime is still not removed
  24. Bugzilla 21702: avoid quadratic template expansion in constraints of multiple search term versions of std.algorithm.searching.startsWith & endsWith
  25. Bugzilla 21704: Nullable fails to destroy static array elements
  26. Bugzilla 21705: Nullable!T.opEquals fails for T with non-const opEquals overload
  27. Bugzilla 21707: std.base64: Faulty input creates range error instead of Base64Exception
  28. Bugzilla 21708: SumType.opEquals gives confusing error message
  29. Bugzilla 21721: casting std.BigInts to built-in floating point types doesn't work without -preview=dip1000
  30. Bugzilla 21722: toString(sink, string format) does not work with non-"%s" strings
  31. Bugzilla 21724: std.algorithm.mutation.copy fails on overlapping arrays if the source array's pointer is less than the destination array's pointer
  32. Bugzilla 21728: rawRead calls fread with NULL if invoked on closed readEnd of Pipe (segfault)
  33. Bugzilla 21729: rawRead derefences null pointer if invoked on closed File (segfault)
  34. Bugzilla 21730: null ptr dereferenced in ChunksImpl.opApply (SIGSEGV)
  35. Bugzilla 21738: std.format.spec: singleSpec should throw on "%%"
  36. Bugzilla 21758: std.experimental.checkedint opBinaryRight with integer left-hand side does not compile for any operators except + and -
  37. Bugzilla 21777: std.format: several issues when formatting integers with precision
  38. Bugzilla 21801: std.typecons.ReplaceType does not work for in parameters
  39. Bugzilla 21814: std.format: grouping with width 0 causes floating point exception
  40. Bugzilla 21817: std.format: %u on integer does not print unsigned value
  41. Bugzilla 21820: std.format: formatting zero should never lead to empty string
  42. Bugzilla 21834: std.numeric.gcd can't handle negative values
  43. Bugzilla 21836: std.format: grouping may cause RangeError
  44. Bugzilla 21838: std.format: Grouping garbles up %a output
  45. Bugzilla 21840: std.format: grouping ignores space flag with %e
  46. Bugzilla 21841: std.format: grouping produces strange result with zero precision and %e
  47. Bugzilla 21842: std.format: "%-+05,g" adds extra comma
  48. Bugzilla 21846: std.format: provided format string for toString does not work with grouping
  49. Bugzilla 21853: std.format: formatting real.max in CTFE fails
  50. Bugzilla 21863: FieldNameTuple returns emptry string for interfaces
  51. Bugzilla 21875: std.format: wrong number of format specifiers in nested format string of associative arrays should be detected
  52. Bugzilla 21900: std.format: round to even does not work for hex integers with letters

Phobos enhancements

  1. Bugzilla 13595: Extend std.algorithm.groupBy to support non-equivalence relations
  2. Bugzilla 16200: Faster pow implementation for integral exponents
  3. Bugzilla 18024: checkedint.Abort and checkedint.Warn should be @safe
  4. Bugzilla 18627: std.complex is a lot slower than builtin complex types at number crunching
  5. Bugzilla 20756: ImplicitConversionTargets ignores interface inheritance
  6. Bugzilla 21759: std.experimental.checkedint.Checked is not compatible with "%d" and "%x" integer format specifiers
  7. Bugzilla 21760: std.conv.to does not know how to convert a string to a std.experimental.checkedint.Checked!T
  8. Bugzilla 21761: make std.experimental.checkedint.Checked!T.toHash callable when Checked!T is shared
  9. Bugzilla 21808: std.format: It should be possible to change the order of key and value of AAs.
  10. Bugzilla 21847: std.format: %e, %g and %a should be supported for integers too
  11. Bugzilla 21858: std.format: centering output

Druntime regression fixes

  1. Bugzilla 21097: [REG2.083] Stack exhaustion upon large struct .destroy
  2. Bugzilla 21363: [REG2.094] Implementation of core.bitop.ror(x,0) is using UB
  3. Bugzilla 21709: std.conv.emplace not usable in betterC - 2.096
  4. Bugzilla 21712: [REG 2.096.0] sometimes coverage *.lst files are corrupted

Druntime bug fixes

  1. Bugzilla 21371: core.stdcpp.allocator: _Adjust_manually_vector_aligned checks for sentinel unconditionally (Windows only)
  2. Bugzilla 21701: casWeak is not implemented
  3. Bugzilla 21764: checkaction=context doesn't work for empty tuples
  4. Bugzilla 21857: TypeInfo_Array.compare can give wrong result when either array exceeds 2GB

Druntime enhancements

  1. Bugzilla 21784: joining a detached thread results in segfault.
  2. Bugzilla 21789: Codecov should use default umask for file permissions

dlang.org enhancements

  1. Bugzilla 21161: [Variadic Templates] uses outdated example from D1 / Tango
  2. Bugzilla 21869: Invalid hyperlink to doxygen

Contributors to this release (57)

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

previous version: 2.096.0