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

previous version: 2.074.1 – next version: 2.075.1

Download D 2.075.0
released Jul 19, 2017

List of all bug fixes and enhancements in D 2.075.0.

Compiler changes

  1. 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");
  2. 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);
  3. 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.

  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. 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");

Runtime changes

  1. 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" ];
  2. 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.

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

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

Library changes

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

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

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

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

    The 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.stopwatch.benchmark 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. 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.

    The following are examples of the deprecated functions, and their modern replacements.

    Use std.algorithm.searching.find to replace std.string.munch:

    import std.algorithm;
    import std.ascii;
    import std.string;
    import std.utf;
    string s = "\tabc";
    // old
    // new
    s = s.find!(a => !isWhite(a));

    Use std.regex.matchFirst to replace std.string.inPattern:

    import std.string;
    import std.regex;
    // old
    if (inPattern('x', "a-z")) { ... }
    // new
    if ("x".matchFirst(regex("[a-z]"))) { ... }

    Use std.regex.replaceAll to replace std.string.removechars:

    import std.string;
    import std.regex;
    // old
    // new
    "abc".replaceAll(regex("[a-z]"), "");

    Use std.algorithm.iteration.uniq to replace std.string.squeeze:

    import std.algorithm;
    import std.string;
    // old
    // new
  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. 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");

List of all bug fixes and enhancements in D 2.075.0:

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 17352: [REG 2.075a] Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition
  6. Bugzilla 17356: [Reg 2.075] __simd_sto no longer executed
  7. Bugzilla 17399: [REG2.071] core.checkedint.addu cannot inline function
  8. Bugzilla 17451: ICE in ddmd/declaration.d(2179)
  9. Bugzilla 17481: [REG 2.069.0] synchronized: Access Violation with dmd -O on win32
  10. Bugzilla 17492: [REG 2.066] [ICE] AssertError@ddmd/dclass.d(1007): Assertion failure
  11. Bugzilla 17502: [REG2.064] Out contract in class method causes dmd segfault.
  12. Bugzilla 17505: [REG2.075] @safe constructor requires the deconstructor to be safe as well
  13. Bugzilla 17506: [REG2.075] @disable constructor requires members to be initialized
  14. Bugzilla 17545: [REG2.072] __traits(getAttributes, name) evaluates name to value prematurely
  15. Bugzilla 17548: [REG2.072.0] Forward reference error with scope function parameters
  16. Bugzilla 17614: [REG2.075.0-b2] __VERSION__ has the wrong value

DMD Compiler bugs

  1. Bugzilla 7016: local import does not create -deps dependency
  2. Bugzilla 13331: naked asm functions are broken when compiling with -profile
  3. Bugzilla 15896: private ignored when import bindings are used
  4. Bugzilla 15945: sizeof on an invalid type seems to compile.
  5. Bugzilla 16244: compiler ICE on complex typeof() for method arg type
  6. Bugzilla 16566: hasLength should enforce that length has type size_t
  7. Bugzilla 17289: With Xcode 8.3 linker, warnings of "pointer not aligned"
  8. Bugzilla 17317: 2.074.0 release candidate does not have updated backend license
  9. Bugzilla 17335: Function calls in conjunctions do not short circuit when evaluated during compilation
  10. Bugzilla 17337: SIGILL for AVX vector initialization
  11. Bugzilla 17339: ambiguous mangling with const alias argument
  12. Bugzilla 17344: ICE with assignment of post inc-/decremented integral vector
  13. Bugzilla 17349: Covariant overrides should be allowed
  14. Bugzilla 17367: CodeView/MSCOFF: bad debug information for enumerators
  15. Bugzilla 17391: SECURITY: XSS through DDOC comments
  16. Bugzilla 17422: [scope] class reference not initialized as scope variable
  17. Bugzilla 17432: [DIP1000] scope delegates change type, but not mangling
  18. Bugzilla 17450: escaping delegate context pointer not detected for member functions
  19. Bugzilla 17468: Internal assertion fails during CTFE
  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

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

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 17482: [REG 2.074] comile error: Comparing Nullable!Variant with basic type
  4. Bugzilla 17511: [REG 2.075a] std.xml puts grand-children into items
  5. Bugzilla 17555: [REG2.070.0] Control characters in JSON data are invalid and should cause an exception
  6. Bugzilla 17650: [REG v2.075.0 b1-b4] std.getopt range violation

Phobos bugs

  1. Bugzilla 5904: std.json parseString doesn't handle chars outside the BMP
  2. Bugzilla 15517: std.experimental.logger: using 'sharedLog' to change to file logging for default logger does not work
  3. Bugzilla 15534: [std.experimental.logger.core] Documentation mismatch
  4. Bugzilla 15720: iota(long.max, long.min, step) does not work properly
  5. Bugzilla 15763: std.math.approxEqual is not symmetric
  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
  15. Bugzilla 17519: RedBlackTree doesn't like const/immutable elements
  16. Bugzilla 17553: std.json should not do UTF decoding when encoding JSON
  17. Bugzilla 17556: std.json encodes non-BMP characters incorrectly with JSONOptions.escapeNonAsciiChars
  18. Bugzilla 17564: std.experimental.allocator.theAllocator is null within shared static this

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
  9. Bugzilla 17557: std.json should not do UTF decoding when parsing

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
  4. Bugzilla 16856: D does not work on FreeBSD current (what will eventually be 12) due to libunwind bugs

  1. Bugzilla 8107: Float literals are not specified as they are implemented
  2. Bugzilla 17303: type error in the href url under the link Systems Programming
  3. Bugzilla 17469: View source code
  4. Bugzilla 17501: Runnable unittest problem with AST rewrite
previous version: 2.074.1 – next version: 2.075.1