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.075.0 (upcoming)

previous version: 2.074.1
$(NIGHTLY_VERSION To be released, , ,
List of all upcoming bug fixes and enhancements.

Compiler changes

  1. Comparison of values belonging to different enums is deprecated.

    This change does not affect anonymous enumerations.

    enum Status
    enum OtherStatus
    // Deprecated - Even though both good and ok evaluate to 0 they belong to
    // different enumeration types
    static assert(Status.good == OtherStatus.ok);
  2. add __traits(getFunctionVariadicStyle, f)

    Bugzilla 17421

    import core.stdc.stdarg;
    void novar() {}
    extern(C) void cstyle(int, ...) {}
    extern(C++) void cppstyle(int, ...) {}
    void dstyle(...) {}
    void typesafe(int[]...) {}
    static assert(__traits(getFunctionVariadicStyle, novar) == "none");
    static assert(__traits(getFunctionVariadicStyle, cstyle) == "stdarg");
    static assert(__traits(getFunctionVariadicStyle, cppstyle) == "stdarg");
    static assert(__traits(getFunctionVariadicStyle, dstyle) == "argptr");
    static assert(__traits(getFunctionVariadicStyle, typesafe) == "typesafe");
    static assert(__traits(getFunctionVariadicStyle, (int[] a...) {}) == "typesafe");
    static assert(__traits(getFunctionVariadicStyle, typeof(cstyle)) == "stdarg");
  3. add __traits(getParameterStorageClasses, f, i)

    Bugzilla 17425

    ref int foo(return ref const int* p, scope int* a, out int b, lazy int c);
    pragma(msg, __traits(getParameterStorageClasses, foo, 0));
    static assert(__traits(getParameterStorageClasses, foo, 0)[0] == "return");
    static assert(__traits(getParameterStorageClasses, foo, 0)[1] == "ref");
    pragma(msg, __traits(getParameterStorageClasses, foo, 1));
    static assert(__traits(getParameterStorageClasses, foo, 1)[0] == "scope");
    static assert(__traits(getParameterStorageClasses, foo, 2)[0] == "out");
    static assert(__traits(getParameterStorageClasses, typeof(&foo), 3)[0] == "lazy");
  4. Deprecate empty statements made by semicolon

    Creating empty statements using semicolons, for which was previously issued a warning is now causing a deprecation hint.

  5. The deprecated built-in array properties .sort and .reverse were removed.

    Usage of those built-in array properties was deprecated since 2.072.0 and they have now been removed. Use std.algorithm.sorting.sort and std.algorithm.mutation.reverse instead.

Runtime changes

  1. Make fiber stack protection-page size configurable

    It is now possible to change the guard page size by using the new Fiber's constructor argument - guard_page_size. It defaults to PAGE_SIZE (the same it used to be on Windows), and specifying 0 will turn this feature off.

  2. Add Fiber's stack-protection page for Posix.

    The feature already existing for Windows' fiber implementation is now added to the systems using mmap to allocate fibers' stacks: After (or before) the last page used for the Fiber's stack, the page is allocate which is protected for any kind of access. This will cause system to trap immediately on the fiber's stack overflow. If in debugger session, one can inspect contents of the memory before or after stack pointer and it can be seen if it contains END OF FIBER string pattern.

  3. TypeInfo.init now refers to type property.

    TypeInfo.init used to refer to the method that is now called TypeInfo.initializer. The name change was necessary because the name "init" would clash with the type property of the same name (init). TypeInfo.init now refers to the type property.

  4. Windows: the DATA and TLS segment can now be configured to be scanned precisely.

    A new runtime option "scanDataSeg" has been added to enable precise scanning of the DATA and the TLS segments. This uses information generated by the compiler to identify possible pointers inside these segments. Possible option values are "conservative" (default) and "precise".

    As usual, this option can be set by the environment, the command line or by embedding the option into the executable similar to the GC options.

    For example add this code to your main module to enable precise scanning:

    extern(C) __gshared string[] rt_options = [ "scanDataSeg=precise" ];

Library changes

  1. Several functions in std.string have been deprecated

    The functions std.string.inPattern, std.string.countchars, std.string.removechars, std.string.squeeze, and std.string.munch, have all been deprecated. These functions are obsolete, as their functionality is better covered by the functions in std.regex and std.algorithm. They will be removed from std.string on May 2018.

    If you still need to use these, please see undeaD.

  2. std.datetime has been split into a package.

    std.datetime is now a package containing the following modules:

    std.datetime.package publicly imports all of those modules. So, it should be the case that no existing code will break, as everything in std.datetime will still be imported by importing std.datetime. New code can choose to import the modules individually or to import the entire package. contains Date, TimeOfDay, DateTime, and the related free functions. It also contains DateTimeException.

    std.datetime.interval contains the *Interval and *IntervalRange types as well as the related free functions.

    std.datetime.systime contains SysTime and the related free functions.

    std.datetime.timezone contains the time zone types.

    std.datetime.package contains StopWatch and the benchmarking functions (so, they can only be imported via std.datetime and not via a submodule). As those functions use core.time.TickDuration (which is being replaced by core.time.MonoTime, they are slated for deprecation. )

    std.datetime.stopwatch has been added. It contains versions of StopWatch and benchmark which have almost the same API as the existing symbols, but they use core.time.MonoTime and core.time.Duration instead of core.time.TickDuration. In the next major release, the old functions in std.datetime.package will be deprecated, so code which uses the old benchmarking functions should be updated to use std.datetime.stopwatch.

    However, note that in order to avoid irreconcilable symbol conflicts between the new and old versions, std.datetime.stopwatch will not be publicly imported by std.datetime.package until the old symbols have been removed. So, for the time being, code using std.datetime.stopwatch.StopWatch or std.datetime.benchmark.StopWatch will need to import std.datetime.stopwatch directly. Code which imports both std.datetime and std.datetime.stopwatch will need to either use selective imports or fully qualified symbols to reconcile the symbol conflicts, but no code will be affected by the changes until it's updated to import std.datetime.stopwatch, and when the old symbols are finally removed, the selective imports and fully qualified paths to the new symbols will continue to work and won't break (though at that point, simply importing std.datetime will work, since std.datetime.package will have been updated to publicly import std.datetime.stopwatch). Code that simply imporst std.datetime.stopwatch without importing std.datetime will not have to worry about symbol conflicts.

  3. Added support for 64 bit CRC

    Support for both ISO and ECMA 64 bit CRC was added to std.digest.crc.

    import std.digest.crc;
    void main()
        ubyte[8] hash64ecma = crc64ECMAOf("abc");
        assert(crcHexString(hash64ecma) == "2CD8094A1A277627");
        ubyte[8] hash64iso = crc64ISOOf("abc");
        assert(crcHexString(hash64iso) == "3776C42000000000");
  4. Added a constant time comparison function for cryptographic hashes

    Added a new function to std.digest.digest.secureEqual that compares two ranges that represent hashes in a secure manner. The comparison is done in constant time regardless of the equality of the two ranges in order to protect against timing attacks. For more information on the attack, please refer to the docs on std.digest.digest.secureEqual.

    import std.digest.digest : secureEqual, toHexString;
    import std.digest.hmac : hmac;
    import std.digest.sha : SHA1;
    import std.string : representation;
    void main()
        // a typical HMAC data integrity verification
        auto secret = "A7GZIP6TAQA6OHM7KZ42KB9303CEY0MOV5DD6NTV".representation;
        auto data = "data".representation;
        string hex1 = data.hmac!SHA1(secret).toHexString;
        string hex2 = data.hmac!SHA1(secret).toHexString;
        string hex3 = "data1".representation.hmac!SHA1(secret).toHexString;
        assert( secureEqual(hex1, hex2));
        assert(!secureEqual(hex1, hex3));
  5. hasLength now enforces that length has type size_t

    Historically hasLength!R yielded true for types whereby R.length returns other types convertible to ulong, such as int, ushort, const(size_t), user-defined types using alias this, or notably ulong on 32-bit systems. This behavior has been deprecated. After December 2017, std.range.primitives.hasLength will yield true only if R.length yields the exact type size_t.

  6. std.range.slide (a fixed-size sliding window range) was added

    std.range.slide allows to iterate a range in sliding windows:

    import std.array : array;
    import std.algorithm.comparison : equal;
    assert([0, 1, 2, 3].slide(2).equal!equal(
        [[0, 1], [1, 2], [2, 3]]
        [[0, 1, 2], [1, 2, 3], [2, 3, 4]]
    assert(iota(7).slide(2, 2).equal!equal([[0, 1], [2, 3], [4, 5]]));
    assert(iota(12).slide(2, 4).equal!equal([[0, 1], [4, 5], [8, 9]]));
    // set a custom stepsize (default 1)
    assert(6.iota.slide(1, 2).equal!equal(
        [[0], [2], [4]]
    assert(6.iota.slide(2, 4).equal!equal(
        [[0, 1], [4, 5]]
    // allow slide with less elements than the window size
        [[0, 1, 2]]

  7. List of all bug fixes and enhancements in D 2.075.0 (upcoming):

    DMD Compiler regressions

    1. Bugzilla 16408: [REG2.065] left-to-right order of evaluation of function arguments not consistently followed
    2. Bugzilla 17275: [REG 2.072.0] AssertError@declaration.d(2121): Assertion failure
    3. Bugzilla 17293: "Using C++ Classes From D" example no longer works
    4. Bugzilla 17338: [Reg 2.075] link failure unsupported symbol section 0xff01
    5. Bugzilla 17356: [Reg 2.075] __simd_sto no longer executed
    6. Bugzilla 17399: [REG2.071] core.checkedint.addu cannot inline function
    7. Bugzilla 17451: ICE in ddmd/declaration.d(2179)
    8. Bugzilla 17502: [REG2.064] Out contract in class method causes dmd segfault.
    9. Bugzilla 17505: [REG2.075] @safe constructor requires the deconstructor to be safe as well
    10. Bugzilla 17506: [REG2.075] @disable constructor requires members to be initialized
    11. Bugzilla 17522: win64.mak broken

    DMD Compiler bugs

    1. Bugzilla 4014: CodeView debug type info not linked in from library
    2. Bugzilla 7016: local import does not create -deps dependency
    3. Bugzilla 13331: naked asm functions are broken when compiling with -profile
    4. Bugzilla 14246: RAII - proper destruction of partially constructed objects/structs
    5. Bugzilla 15896: private ignored when import bindings are used
    6. Bugzilla 15945: sizeof on an invalid type seems to compile.
    7. Bugzilla 16244: compiler ICE on complex typeof() for method arg type
    8. Bugzilla 16566: hasLength should enforce that length has type size_t
    9. Bugzilla 17289: With Xcode 8.3 linker, warnings of "pointer not aligned"
    10. Bugzilla 17335: Function calls in conjunctions do not short circuit when evaluated during compilation
    11. Bugzilla 17337: SIGILL for AVX vector initialization
    12. Bugzilla 17339: ambiguous mangling with const alias argument
    13. Bugzilla 17344: ICE with assignment of post inc-/decremented integral vector
    14. Bugzilla 17349: Covariant overrides should be allowed
    15. Bugzilla 17367: CodeView/MSCOFF: bad debug information for enumerators
    16. Bugzilla 17391: SECURITY: XSS through DDOC comments
    17. Bugzilla 17422: [scope] class reference not initialized as scope variable
    18. Bugzilla 17432: [DIP1000] scope delegates change type, but not mangling
    19. Bugzilla 17450: escaping delegate context pointer not detected for member functions
    20. Bugzilla 17491: Compiles on invalid: *&s.init.var is not an lvalue
    21. Bugzilla 17495: __traits(getParameterStorageClasses) doesn't work with tuples as parameters
    22. Bugzilla 17551: VC build: bad mangling of real template argument

    DMD Compiler enhancements

    1. Bugzilla 6227: Comparison of different enums
    2. Bugzilla 16197: Constructors/postblits and destructors don't match up for array initialisation
    3. Bugzilla 16540: Attributes do not propagate correctly in lazy params
    4. Bugzilla 16600: Wrong error message for ambiguous mutable/immutable constructor
    5. Bugzilla 17396: Add colorized syntax highlighting to error messages emitted by dmd
    6. Bugzilla 17419: add __traits(getLinkage, s) to the the linkage of symbol s
    7. Bugzilla 17425: add __traits(getParameterStorageClasses, f, i)
    8. Bugzilla 17429: [scope] each scope class references adds another delete call
    9. Bugzilla 17457: Named Return Value Optimization (NRVO) not done with return of constructor call
    10. Bugzilla 17494: Do not execute scope(...) if an Error exception has been thrown
    11. Bugzilla 17499: with -betterC switch, call C's assert failure function rather than druntime's

    Phobos regressions

    1. Bugzilla 17452: Undefined references in std.container.array
    2. Bugzilla 17472: [Reg 2.075] typeof(stdin) is no longer a File
    3. Bugzilla 17511: [REG 2.075a] std.xml puts grand-children into items

    Phobos bugs

    1. Bugzilla 15517: std.experimental.logger: using 'sharedLog' to change to file logging for default logger does not work
    2. Bugzilla 15534: [std.experimental.logger.core] Documentation mismatch
    3. Bugzilla 15720: iota(long.max, long.min, step) does not work properly
    4. Bugzilla 15763: std.math.approxEqual is not symmetric
    5. Bugzilla 16232: std.experimental.logger.core.sharedLog isn't thread-safe
    6. Bugzilla 16246: cannot call iota with 3 [u]bytes or 3 [u]shorts
    7. Bugzilla 16256: std.experimental.logger cant log a dstring properly
    8. Bugzilla 16326: filter is not lazy enough & has weird save behavior
    9. Bugzilla 17251: Appender.put errors out with const input range elements
    10. Bugzilla 17270: std.experimental.Final fails on pointers
    11. Bugzilla 17283: std.experimental.typecons uses private module members
    12. Bugzilla 17288: formattedWrite error when width/precision provided and no value to format
    13. Bugzilla 17314: BinaryHeap crashes upon insertion if heapified with an array of length 1
    14. Bugzilla 17328: std.experimental.logger: wrong hex formatting for zeros

    Phobos enhancements

    1. Bugzilla 6621: Superimposition amount for std.range.chunks
    2. Bugzilla 7102: std.numeric.gcd with BigInts too
    3. Bugzilla 10001: string formatting with underscores
    4. Bugzilla 16108: to!string fails on struct with disabled postblit
    5. Bugzilla 16615: std.process is missing functionality for child processes
    6. Bugzilla 17286: A function for comparing two digests securely
    7. Bugzilla 17327: std.getopt: repeated options unrecognised
    8. Bugzilla 17394: std.file.mkdirRecurse isn't @safe

    Druntime bugs

    1. Bugzilla 9275: [GC] removeRoot hits assert(0) instead of being a no-op (as documented)
    2. Bugzilla 12233: Attempting to use TypeInfo.init results in a compiler error due to lack of 'this'.
    3. Bugzilla 13186: core/sys/posix/sys/uio.d is not linked into the standard lib bugs

    1. Bugzilla 8107: Float literals are not specified as they are implemented
    2. Bugzilla 17224: Foreach documentation still refers to TypeTuples, rather than AliasSequences
    3. Bugzilla 17303: type error in the href url under the link Systems Programming
    4. Bugzilla 17305: [SPEC] ABI page still has references to D1 Phobos
    5. Bugzilla 17469: View source code
    6. Bugzilla 17501: Runnable unittest problem with AST rewrite
    7. Bugzilla 17509: [typo] "refered to" ("referred to")
    8. Bugzilla 17510: How could 509 be a byte value?
    9. Bugzilla 17513: [english] "a enum" -> "an enum" enhancements

    1. Bugzilla 17262: Better docs for rdmd
    2. Bugzilla 17524: [The C Preprocessor vs D] "need to worry about"?
previous version: 2.074.1