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

previous version: 2.090.1

Download D 2.091.0
released Mar 08, 2020

2.091.0 comes with 18 major changes and 66 fixed Bugzilla issues. A huge thanks goes to the 55 contributors who made 2.091.0 possible.

List of all bug fixes and enhancements in D 2.091.0.

Compiler changes

  1. Class deallocator have been removed from the language

    Class deallocator have been deprecated in v2.080.0 (see the changelog entry), and turned into an error in v2.087.0. They have now been completely removed from the language, and the parser won't recognize them anymore.

  2. Can now report line numbers in GNU error style

    DMD now supports reporting errors and warnings in GNU error style, that is, filename:line[:column]: message. This may ease compatibility with existing IDEs.

    Enable this style by calling DMD with -verror-style=gnu.

  3. Added experimental C++ header generation from extern(C|C++) declarations

    DMD can now write C++ header files which contain bindings for declarations in existing D files that were marked as extern(C) or extern(C++).

    This feature is available via the following command line switches:

    • -HC: Write the generated headers to standard output
    • -HCf=<file>: Write the generated headers to file
    • -HCd=<directory>: Write the generated headers to file (not implemented yet)

    Consider the following example:

    module a;
    
    extern(C) int foo(int a) { ... }
    extern(C++) void bar() { ... }
    void ignored() { ... }
    
    module b;
    
    extern (C++) struct S
    {
        string name;
        this (string name) { ... }
        bool bar() { ... }
    }
    
    module c;
    
    import a, b;
    
    extern (C++) class C
    {
        S[] s;
        this () {}
        bool bar() { ...}
    }
    
    

    Compiling these modules with dmd -c -o- -HC a.d b.d c.d will generate the following header:

    #pragma once
    
    // Automatically generated by dmd -HC
    
    #include <assert.h>
    #include <stddef.h>
    #include <stdio.h>
    #include <string.h>
    
    #define _d_void void
    #define _d_bool bool
    #define _d_byte signed char
    #define _d_ubyte unsigned char
    #define _d_short short
    #define _d_ushort unsigned short
    #define _d_int int
    #define _d_uint unsigned
    #define _d_long long long
    #define _d_ulong unsigned long long
    #define _d_float float
    #define _d_double double
    #define _d_real long double
    #define _d_char char
    #define _d_wchar wchar_t
    #define _d_dchar unsigned
    typedef _d_long d_int64;
    #define _d_null NULL
    
    // Parsing module a
    // Parsing module b
    // Parsing module c
    struct S;
    extern "C" _d_int foo(_d_int a);
    
    extern _d_void bar();
    
    // ignoring function a.ignored because of linkage
    struct S
    {
        DArray< _d_char > name;
        S(DArray< _d_char > name);
        _d_bool bar();
        S() : name() {}
    };
    
    class C
    {
    public:
        DArray< S > s;
        C();
        virtual _d_bool bar();
    };
    

    Refer to the documentation for further information regarding C++ interoperation.

    Note that this feature is considered experimental and might not work correctly sometimes. Please open an issue in the bug tracker if you encounter a bug while using this feature.

Runtime changes

  1. Added missing pthread_attr_destroy in some place.

    Added missing pthread_attr_destroy, this prevents memory leak in some OSes such as freebsd or solaris.

  2. Expanded bindings in core.sys.windows.security

    Many enum members were missing, the list is now reasonably up-to-date.

  3. Added core.stdcpp.memory.unique_ptr

    Added core.stdcpp.memory.unique_ptr, which corresponds to C++ std::unique_ptr.

  4. Added TFD_TIMER_CANCEL_ON_SET.

    Added TFD_TIMER_CANCEL_ON_SET option, which marks a timer as cancelable if the realtime clock is used.

Library changes

  1. std.bigint is now @safe

    Many BigInt operations used to be @system because of assembly routines and casts from mutable to immutable data. These parts are now marked @trusted, so that BigInt can now be used in @safe code.

  2. Replaced approxEqual by isClose in std.math.

    The template approxEqual for comparing floating point numbers has been replaced by the template isClose, 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).

    In one of the next releases approxEqual will be deprecated and eventually removed.

  3. Removed deprecated std.format.Mangle.

    The deprecated enum Mangle containing mangled names of basic types has been removed. Use std.demangle.demangle instead to parse mangled names.

  4. Removed deprecated structs ByLine, ByChunk, ByRecord from std.stdio.

    The deprecated structs ByLine, ByChunk, ByRecord have been removed from std.stdio. Use the functions byLine, byChunk, byRecord instead.

  5. Removed deprecated functions from std.string

    The deprecated functions inPattern, countchars, removechars, squeeze and munch in std.string have been removed. Any code that still needs them can use UndeaD instead.

  6. std.algorithm.sorting.schwartzSort supports binary transform functions too

    The transform template parameter of std.algorithm.sorting.schwartzSort isn't restricted to unary functions taking an element anymore, but can also be a binary function taking an element and its index in the original range.

    The original index can therefore be used when computing the transformed value to sort by.

  7. Added curry to std.functional

    Converts a function of multiple parameters to a function of 1 parameter that returns a function of 1 parameter... until it runs out of parameters and evaluates the function. Essentially: f(x, y, z) == curry(f)(x)(y)(z)

Installer changes

  1. The install script now runs on Windows

    The D installation script (install.sh, available at dlang.org/install.sh) now supports POSIX-like environments on Windows. This allows installing and using Windows versions of DMD, LDC, and Dub from e.g. CygWin or MSys2, thus providing a unified way of installing D compilers across supported platforms.

  2. The Windows installation has received a couple of updates

    • the released dmd.exe is now built with LDC for a reduction of compilation times of 30-40%.
    • 64-bit builds of dmd.exe, dub.exe and lld-link.exe have been added to the bin64 folder
    • The bundled Windows libraries and definitions have been changed from MinGW 5.0.2 to MinGW 7.0.0 (with additional wide string main entrypoints).
    • The bundled LLD linker on Windows has been upgraded to 9.0.0 (including a patch that allows exceptions to work on Win32).
    • The VC runtime linked with the MinGW import libraries has been upgraded to msvcr120.dll (the last version that allows simple copying and no dependency on the universal C runtime). The redistributable DLLs have been added to the respective bin folder for immediate use without running additional installers.
    • The curl libraries/DLLs have been updated to 7.68.
    • ancient windbg.exe has been removed from the installation.
    • The installer now detects an installation of VS 2019. If no VC installation is found the proposed download is not VS 2017 anymore, but VS 2019.

Dub changes

  1. Environment variable SOURCE_FILES added

    New environment variable $SOURCE_FILES added containing source files from build settings.

  2. DUB now has zsh completion

    A zsh completion script is now present in scripts/zsh-completion/_zsh. It can be installed under the user's prefered fpath and provides completion for options for the most common dub commands, as well as list of packages (based on local packages), e.g. for dub add.


List of all bug fixes and enhancements in D 2.091.0:

DMD Compiler regressions

  1. Bugzilla 10100: Identifiers with double underscores and allMembers
  2. Bugzilla 15812: static struct inside extern(C++) class cannot be used as key to associative array
  3. Bugzilla 16709: [Reg 2.068] Error: common.to at common.d conflicts with common.to at common.d
  4. Bugzilla 17098: Takes hours to -O compile then fails with Internal error: backend/cgreg.c 405
  5. Bugzilla 17145: [REG2.066.0] Tuple expansion error in local enum declaration

DMD Compiler bugs

  1. Bugzilla 9937: CTFE floats don't overflow correctly
  2. Bugzilla 11847: sub-pkg not available as qualified name
  3. Bugzilla 17257: Wrong recursive template destructor reflection
  4. Bugzilla 18147: Debug information limited in size
  5. Bugzilla 19479: Garbage .init in string mixins in static foreach in mixin templates
  6. Bugzilla 19504: pragma(mangle) ignored for C++ destructors
  7. Bugzilla 19515: POSIX,C++: Template argument pack wrongly mangled
  8. Bugzilla 20362: dmd fails to infer scope parameter for delegate
  9. Bugzilla 20375: std.typecons.RefCounted does not work with checkaction-context
  10. Bugzilla 20421: Exceptions don't work when linking through lld-link
  11. Bugzilla 20474: Deprecation warnings inside deprecated function template
  12. Bugzilla 20507: Debug statements affect inference of templated functions attributes
  13. Bugzilla 20514: obj-c info incorrectly placed in __objc_const section
  14. Bugzilla 20530: is(<...> == module/package) does not work with string mixins
  15. Bugzilla 20537: traits isPackage/isModule and is(package/module) fail on single level package.d import
  16. Bugzilla 20538: malformed enum definition compiles
  17. Bugzilla 20545: Segfault/Assertion failure when parsing invalid AA literal
  18. Bugzilla 20547: Wrong error message when trying to "new" an associative array
  19. Bugzilla 20551: In @safe code and using delegates, it's possible to escape references to function frame
  20. Bugzilla 20592: [GCC ASM] [ICE] dmd/iasmgcc.d(332): Assertion failure
  21. Bugzilla 20613: String switch in -betterC fails for 7+ labels

DMD Compiler enhancements

  1. Bugzilla 20569: [DIP1000] allow taking the address of a scope struct field if it has no indirections

Phobos regressions

  1. Bugzilla 7006: std.math.pow (integral, integral) crashes on negative exponents

Phobos bugs

  1. Bugzilla 5232: [patch] std.conv.to & std.conv.roundTo report invalid overflows for very large numbers
  2. Bugzilla 5628: std.math unittest disabled - roundoff error in pow() on SSE2
  3. Bugzilla 7446: [TDPL] Trivial asynchronous file copy example crashes with OwnerTerminated
  4. Bugzilla 8388: std.traits.MemberFunctionsTuple doesn't work with constructors or destructors
  5. Bugzilla 12461: Typedef and opOpAssign
  6. Bugzilla 15891: Compiler error when std.algorithm.cache after 2 layers of std.algorithm.map
  7. Bugzilla 17427: std.concurrency internal errors on uninitialised mailbox
  8. Bugzilla 20232: WhiteHole is unusable with @safe interface functions
  9. Bugzilla 20259: [Function Socket.bind] Doesn't inform what Exception it throws
  10. Bugzilla 20493: Incorrect result of BigInt * BigInt
  11. Bugzilla 20521: Checking for and getting empty variables on Wine / XP fails
  12. Bugzilla 20540: (White|Black)Hole does not work with return|scope functions
  13. Bugzilla 20542: std.math.nextafter(NaN, y) and nextafter(x, NaN) should return NaN
  14. Bugzilla 20544: socket.remoteAddress throws out of memory error with unix domain socket peer
  15. Bugzilla 20585: std.stdio.File open() failure leaves File in invalid state
  16. Bugzilla 20639: Some BitArray methods should be const/pure/nothrow/...

Phobos enhancements

  1. Bugzilla 20146: Allow casting from std.bigint.BigInt to built-in floating point types
  2. Bugzilla 20480: make std.getopt ready for DIP 1000
  3. Bugzilla 20548: Use bit vector instead of bool[] in RandomCover when choices cannot be packed in a single word
  4. Bugzilla 20566: std.sformat should avoid allocating memory when printing floating point values

Druntime regressions

  1. Bugzilla 19322: A lot of memory is consumed and not freed to the system when Exception is formatted with stacktrace in debug

Druntime bugs

  1. Bugzilla 15322: version(Unicode) should affect only default aliases
  2. Bugzilla 16658: Win32API: default IE ver. set to 4.0 is too old
  3. Bugzilla 19489: Null function call results in no stack trace
  4. Bugzilla 19909: core.stdc.errno missing POSIX error code on Windows
  5. Bugzilla 20459: Runtime arg parsing should stop at '--'
  6. Bugzilla 20468: emplace doesn't forward constructor arguments' (l/r)valueness
  7. Bugzilla 20476: chainTogether leaks exception with -dip1008
  8. Bugzilla 20512: Return type of memchr should be inout(void)* rather than void*
  9. Bugzilla 20513: Return type of wmemchr should be inout(wchar_t)* rather than wchar_t*
  10. Bugzilla 20591: ldc doesn't print files' directories when printing stack trace
  11. Bugzilla 20629: atomicStore does not compile for struct using -m64

Druntime enhancements

  1. Bugzilla 19218: object.destroy should check for classes for static arrays
  2. Bugzilla 20550: Use fixed seeds for treaps in GC
  3. Bugzilla 20567: GC should not start threads for parallel marking in simple programs
  4. Bugzilla 20577: Add missing symbols related to Windows UAC

dlang.org bugs

  1. Bugzilla 20500: running examples on the home page only displays '1 unittests passed'

Installer enhancements

  1. Bugzilla 20489: Installer deleting files after install

Contributors to this release (55)

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

previous version: 2.090.1