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

previous version: 2.086.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,, 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.087.0 comes with 13 major changes and 23 fixed Bugzilla issues. A huge thanks goes to the 51 contributors who made 2.087.0 possible.

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

Compiler changes

  1. A new syntax is available to declare an alias to a function type

    It's now possible to declare an alias to a function type using the alias syntax based on the assignment operator. The declaration consists of the return type, followed by parameters and ends with optional (member) function attributes:

        alias AliasDeclarationX ;

    AliasDeclarationX: AliasDeclarationY AliasDeclarationX , AliasDeclarationY

    AliasDeclarationY: ... Identifier TemplateParametersopt = StorageClassesopt BasicType Parameters MemberFunctionAttributesopt

    For example:

    alias int OldStyleFunAlias(string);
    alias NewStyleFunAlias = int(string);
    int fun(string p){return 0;}
    static assert(is(typeof(fun) == NewStyleFunAlias));

    Note that an advantage compared to the old syntax is that the new allows to express function template types:

    alias SetterProto(T) = void(T t);
    alias GetterProto(T) = T() const;
  2. Add Markdown-inspired features to Ddoc

    With the -preview=markdown flag to dmd, Ddoc now supports Markdown features like headings, emphasized text, links and more. The full list of features is described in the Ddoc documentation page.

    Use the -transition=vmarkdown flag together with the -preview=markdown flag to log all instances of Markdown features as they're processed in your documentation.

  3. scope as a type constraint on class declarations is deprecated.

    scope as a type constraint on class declarations has been deprecated for quite some time. However, starting with this release, the compiler will emit a deprecation warning if used.

    scope class C { }  // Deprecation: `scope` as a type constraint is deprecated.  Use `scope` at the usage site.

    Note that this does not apply to structs. Deprecation of scope as a type constraint on structs is still awaiting a decision.

  4. Usage of this and super as types is obsolete

    Prior to this release, this and super could be used as both data or types depending on the context, but was deprecated about a year ago. Starting with this release using this or super as a type will result in a compiler error.

    class C
        shared(this) x;    // Error: Using `this` as a type is obsolete. Use `typeof(this)` instead
    class D : C
        shared(super) a;   // Error: Using `super` as a type is obsolete. Use `typeof(super)` instead
        super b;           // Error: Using `super` as a type is obsolete. Use `typeof(super)` instead
    Use typeof(super) or typeof(this) instead.
    class C
        shared(typeof(this)) x;
    class D : C
        shared(typeof(super)) a;
        typeof(super) b;
  5. fix Issue 16002 - Add is(sym == module) and is(sym == package)

    This enhancement adds two new forms of the is(), expression, which determine whether a given symbol represents a module or package.

    It also adds __traits(isModule, sym) and __traits(isPackage, sym), which do the same thing.

  6. Local templates can now receive local symbols.

    With this release local and member templates can be instantiated with local symbols.

    struct S
        private int _m;
        void exec(alias fun)()
        int localVar;
        void set(int i)
            localVar = i;
        auto obj = S(10);
        assert(localVar == 10);

    This was a long-standing limitation that disturbed the metaprograming experience.

    See issue 5710.

  7. Class allocators and deallocators are now obsolete

    Starting with this release any use of class allocators or deallocators will result in a compilation error.

    See the deprecated features page for more information.

  8. The deprecation phase for access checks is finished

    The -transition=import and -transition=checkimports switches no longer have an effect and are now deprecated. Symbols that are not visible in a particular scope will no longer be found by the compiler.

  9. Template alias parameters now match basic types as a conversion.

    With this release, templates with alias parameters can be instantiated with basic types, such as int or void function().

    template Example(alias A) { alias Example = A[]; }
    alias IntArray = Example!int;
    template MatchType(T) { enum MatchType = "type"; }
    template MatchType(alias A) { enum MatchType = "alias"; }
    // alias matches, but type matches take priority.
    static assert (MatchType!int == "type");

    Templates with alias parameters already matched named types, lambdas, and even value literals. Templates with variadic parameters already matched basic types. This led to strange replacements for alias such as template Template(T...) if (T.length == 1). Those replacements are no longer necessary.

    As a consequence, in some cases templates will match that did not used to. For instance, a template may have falsely relied on alias parameters being "something callable" vs. type parameters being "the type of something callable", such as

    void fun(T...)(T callable) { ... }
    void fun(alias A)() { ... }

    Such overloads may now need to explicitly check whether A is callable in the second case:

    void fun(alias A)() if (__traits(compiles, A())) { ... }
    // shorter, but may miss cases like structs with a static opCall
    void fun(alias A)() if (!isType!A) { ... }

Runtime changes

  1. Convert FreeBSD's sys/ttycom.h into core.sys.posix.sys.ttycom

    In FreeBSD, as in OSX, the tty part of ioctl is defined in sys/ttycom.h which is included by sys/ioctl.h. In druntime, there were OSX part of definitions in ttycom.d, but there were no FreeBSD equivalent. This change implements FreeBSD part of ttycom.d and ioccom.d, and public import core.sys.posix.sys.ttycom in ioctl.d. The OSX users and FreeBSD users can now use full ioctls related to tty by importing core.sys.posix.sys.ioctl, like including sys/ioctl.h in C language. (For example, TIOCGWINSZ ioctl was not provided in FreeBSD.) Since there are only version(OSX) and version(FreeBSD) part in ttycom.d, public import'ing core.sys.posix.sys.ttycom from ioctl.d will make no harm to other platforms.

  2. GC now marks the heap with multiple threads

    The garbage collector now uses available CPU cores to mark the heap faster. This reduces pause times for a collection considerably.

    By default, the GC uses all available logical cores of your CPU. This might affect your application if it has threads that are not suspended during the mark phase of the collection. You can configure the number of additional threads used for marking by DRT option parallel to the GC configuration, e.g. by passing --DRT-gcopt=parallel:2 on the command line. A value of 0 disables parallel marking completely.

    As usual, you can also embed the configuration into the application by redefining rt_options, e.g.

    extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ];

Library changes

  1. Add overload std.algorithm.sorting.schwartzSort!(alias transform, SwapStrategy ss, R)

    std.algorithm.sorting.schwartzSort now has an overloaded version that can be used to provide a SwapStrategy without also explicitly specifying the predicate to sort by.

    auto s1 = a.schwartzSort!(abs, SwapStrategy.stable);
    // The old syntax still works.
    auto s2 = a.schwartzSort!(abs, "a < b", SwapStrategy.stable);
  2. Phobos is now compiled with -preview=dip1000

    Phobos and Druntime are now compiled with -preview=dip1000.

    This is a major milestone in the transition to DIP1000. Hence, end users can now start using -preview=dip1000 in their own code bases.

    As always, any encountered issue should be reported to the issue tracker.

List of all bug fixes and enhancements in D 2.087.0:

DMD Compiler regressions

  1. Bugzilla 19661: DMD 2.084.0 SIGSEGV in std.traits.isFunction

DMD Compiler bugs

  1. Bugzilla 4923: immutable module variables are modifiable in non-shared module constructors
  2. Bugzilla 5710: cannot use delegates as parameters to non-global template
  3. Bugzilla 6541: using synchronized on a templated method crashes the compiler
  4. Bugzilla 9029: Built-in types treated specially for alias parameters
  5. Bugzilla 13471: CTFE glitch when executing std.digest.crc.crc32Of() and checking the result with enforce(). (keyword: uninitialized variable)
  6. Bugzilla 18794: Compiling with -O causes runtime segfault
  7. Bugzilla 18958: extern(C++) wchar, dchar mangling not correct
  8. Bugzilla 19813: Generated bt instruction seg faults, high 32 bits of register is garbage
  9. Bugzilla 19814: Nested code blocks in Ddoc break formatting
  10. Bugzilla 19857: Name mangling mismatch when compiling with -dip1000
  11. Bugzilla 19870: Generated Copy Constructor disables default construction

DMD Compiler enhancements

  1. Bugzilla 16002: Add __traits(isModule) and __traits(isPackage)
  2. Bugzilla 16020: Allow AliasDeclarationY to express function types
  3. Bugzilla 19856: [aApplycd2]: foreach (int) doesn't work on BigEndian targets

Phobos regressions

  1. Bugzilla 19740: Incorrect result of BigInt * BigInt

Phobos bugs

  1. Bugzilla 19226: std.typecons.Nullable(T, T nullValue) doesn't fully handle non-self-equal nullValue
  2. Bugzilla 19781: etc.c.zlib should be @nogc
  3. Bugzilla 19836: Excessive probability of UUID collisions in std.uuid.randomUUID
  4. Bugzilla 19883: Cyclic constructor call for BigInt(dstring)

Phobos enhancements

  1. Bugzilla 6657: dotProduct overload for small fixed size arrays
  2. Bugzilla 13965: More handy schwartzSort
  3. Bugzilla 19892: Add CTFE support for std.bitmanip: nativeToBigEndian, bigEndianToNative, littleEndianToNative, nativeToLittleEndian

Contributors to this release (51)

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

previous version: 2.086.0