Change Log: 2.073.0
Download D 2.073.0 Beta
to be released Jan 18, 2017
Library changes
- Added std.meta.staticIsSorted to check if an AliasSeq is sorted according to some template predicate.
- Added std.traits.Promoted to get the result of scalar type promotion in multi-term arithmetic expressions
- Added std.algorithm.searching.maxIndex to get the index of the maximum element of a range.
- Added std.algorithm.searching.minIndex to get the index of the minimum element of a range.
- std.traits.hasFunctionAttributes has been added
- std.experimental.ndslice has been deprecated.
Language changes
List of all bug fixes and enhancements in D 2.073.0.
Library changes
- Added std.meta.staticIsSorted to check if an AliasSeq is sorted according to some template predicate.
std.meta.staticIsSorted checks whether an AliasSeq is sorted according to some template predicate.
enum Comp(T1, T2) = T1.sizeof < T2.sizeof; import std.meta : staticIsSorted; static assert( staticIsSorted!(Comp, byte, uint, double)); static assert(!staticIsSorted!(Comp, bool, long, dchar));
Additionally, the compile-time performance of std.meta.staticSort has been greatly improved. Nevertheless, due to compiler limitations it is still an extraordinarily expensive operation to perform on longer sequences; strive to minimize such use.
- Added std.traits.Promoted to get the result of scalar type promotion in multi-term arithmetic expressions
std.traits.Promoted gets the type to which a scalar type will be promoted in multi-term arithmetic expressions
import std.traits : Promoted; static assert(is(typeof(ubyte(3) * ubyte(5)) == Promoted!ubyte)); static assert(is(Promoted!ubyte == int));
See the D specification on scalar type promotions for more information.
- Added std.algorithm.searching.maxIndex to get the index of the maximum element of a range.
std.algorithm.searching.maxIndex gets the index of the maximum element of a range, according to a specified predicate. The default predicate is "a > b".
import std.algorithm.searching : maxIndex; int[] a = [5, 4, 2, 1, 9, 10]; assert(a.minIndex == 5); int[] a; assert(a.minIndex == -1);
- Added std.algorithm.searching.minIndex to get the index of the minimum element of a range.
std.algorithm.searching.minIndex gets the index of the minimum element of a range, according to a specified predicate. The default predicate is "a < b".
import std.algorithm.searching : minIndex; int[] a = [5, 4, 2, 1, 9, 10]; assert(a.minIndex == 3); int[] a; assert(a.minIndex == -1);
- std.traits.hasFunctionAttributes has been added
It exposes a user-friendly way to query for function attributes:
import std.traits : hasFunctionAttributes; // manually annotated function real func(real x) pure nothrow @safe { return x; } static assert(hasFunctionAttributes!(func, "@safe", "pure")); static assert(!hasFunctionAttributes!(func, "@trusted")); // for templated function types are automatically inferred bool myFunc(T)(T b) { return !b; } static assert(hasFunctionAttributes!(myFunc!bool, "@safe", "pure", "@nogc", "nothrow")); static assert(!hasFunctionAttributes!(myFunc!bool, "shared"));
- std.experimental.ndslice has been deprecated.
The synchronization between Phobos and Mir turned out to be a lot of work with litte gain. Users of std.experimental.ndslice are advised to switch to the upstream mir package.
Language changes
List of all bug fixes and enhancements in D 2.073.0:
DMD Compiler regressions
- Bugzilla 16102: [REG2.070] struct dtor replace value on stack
- Bugzilla 16574: [REG 2.072.0-b1] Unexplained errors about functions that overridde anything
- Bugzilla 16678: [REG] Fix for issue 16193 creates major breakage
- Bugzilla 16699: [REG 2.070] stack corruption with scope(exit)
- Bugzilla 16747: [Reg 2.072] Cannot have stack allocated classes in @safe code
- Bugzilla 16980: [REG2.072.0] wrong interface called
- Bugzilla 17029: [Reg 2.072] scope variable may not be returned
DMD Compiler bugs
- Bugzilla 922: export keyword causes undefined references on linux
- Bugzilla 1761: TypeInfo.toString for function types always indicates no-parameter function
- Bugzilla 5995: string append negative integer causes segfault
- Bugzilla 10447: Refused increment of double2 with a immutable(double2)
- Bugzilla 11118: undefined identifier in template structs functions
- Bugzilla 11961: Can't select CRT to link against
- Bugzilla 12430: non compile-time __simd opcode causes ICE
- Bugzilla 13927: optimizer hangs in optelem with SIMD initialization
- Bugzilla 14613: DMD: Internal error: backend/cod1.c 1567 on '-O' switch
- Bugzilla 15576: extern(C++, namespace) wrong mangling of variables (Windows)
- Bugzilla 15862: Functions that return types with mutable indirections should be weakly pure, not strongly pure
- Bugzilla 15989: Initializing manifest constants with CTFE allocated data
- Bugzilla 16116: Infinite loop on (somewhat complex) simd math
- Bugzilla 16146: postblit is not called on struct creation with "{field:value}" syntax
- Bugzilla 16381: Wrapping a float4 array leads to segfault.
- Bugzilla 16488: [spec][optimization] broadcast scalar to simd vector
- Bugzilla 16499: Misleading error message for 'in' operator with wrong argument
- Bugzilla 16523: [ICE] Internal error: backend/symbol.c 1031
- Bugzilla 16589: Taking address of stack variables in @safe code is allowed in some cases
- Bugzilla 16679: prefetch on old pentium d results in an illegal instruction
- Bugzilla 16743: Intrinsic recognition sometimes fails if a software implementation is available
- Bugzilla 16854: Inline assembler has VMOVLHPS and VMOVHLPS swapped
- Bugzilla 16967: No switch case fallthrough warnings in in/out contracts
- Bugzilla 16977: bad debug info for function default arguments
- Bugzilla 17034: DMD 32 bit PIC wrong code
DMD Compiler enhancements
- Bugzilla 768: A switch to print predefined version identifiers
- Bugzilla 13474: Discard excess precision for float and double (x87)
- Bugzilla 16449: add support for RDTSCP in iasm
- Bugzilla 16558: [Mir] Generic unaligned load/store like (like LDC loadUnaligned and storeUnaligned)
- Bugzilla 16560: [Mir] Prefetch intrinsics like in LDC
- Bugzilla 16703: Support indexing of SIMD vector types
- Bugzilla 16798: Extend -Ipath switch to -Imodule=path so path heirarchy doesn't have to match package heirarchy
- Bugzilla 16958: replace -mavx switch with -mcpu=id
Phobos regressions
- Bugzilla 16609: std.experimental.ndslice.slice issues warnings when building Phobos
- Bugzilla 16661: [REG2.072] std/format.d(1070): Incorrect format specifier: .2f for wstring and dstring
- Bugzilla 16663: [REG 2.072] std.unit.toUpper rejects an alias this to a string
- Bugzilla 16667: [REG] dub test fails on std.conv after upgrade to dmd 2.072.0
- Bugzilla 16682: [REG 2.072] "privatization" of symbols in std.stdio breaks DFMT
Phobos bugs
- Bugzilla 6716: Linking a C program with D library causes DEH errors
- Bugzilla 8087: Improve clarity of std.algorithm documentation
- Bugzilla 9378: std.internal.digest.sha_SSE3 breaks if compiled with PIC
- Bugzilla 9391: Constant std.regex.regex
- Bugzilla 13314: BinaryHeap assumes Store has dup property
- Bugzilla 16048: std.getopt: duplicated options are not detected
- Bugzilla 16135: missing std.format import in std.algorithm.comparison
- Bugzilla 16255: std.algorithm.iteration.each on opApply doesn't support ref
- Bugzilla 16352: dead-lock in std.allocator.free_list unittest
- Bugzilla 16419: issue with ndslice.slice toHash
- Bugzilla 16478: Don't allow to!T() in constraint
- Bugzilla 16588: uniq's BidirectionalRange behavior is inconsistent with its InputRange behavior
- Bugzilla 16611: std.traits.fullyQualifiedName fails with error 'Unrecognized type const(void)'
- Bugzilla 16624: std.path.setExtension ddoc comment is strangely formated
- Bugzilla 16634: std.math exposes yl2x and yl2xp1 publicly
- Bugzilla 16653: ParameterDefaultValueTuple fails to compile when function has lazy param
- Bugzilla 16724: RandomCover.popFront is a no-op for the first call
- Bugzilla 16758: Variant.opIndex result not modified after opAssign
- Bugzilla 16794: dmd not working on Ubuntu 16.10 because of default PIE linking
- Bugzilla 16955: std.process.spawnProcessImpl can crash due to alloca
- Bugzilla 16959: bringToFront fails on char arrays
- Bugzilla 16970: Fix deprecations and warnings when compiling Phobos
- Bugzilla 16996: std.algorithm.remove with SwapStrategy.unstable removes more entries
Phobos enhancements
- Bugzilla 4125: std.numeric.gcd can use a binary GCD
- Bugzilla 16249: std.signals: disconnect() is unsafe during emit()
- Bugzilla 16571: Unittests should not list /tmp/ recursively
- Bugzilla 16628: Special case std.algorithm.equal for known empty or infinite ranges
Druntime regressions
- Bugzilla 16974: [REG2.068] Equal associative arrays with associative array keys are considered unequal
Druntime bugs
- Bugzilla 16651: atomicOp!"-="(ulong, uint) = wrong result/codegen
- Bugzilla 16654: hashOf returns different hashes for the same string value
- Bugzilla 16764: hashOf is misleading, error-prone, and useless
Druntime enhancements
- Bugzilla 16797: Zero clock resolution lead to division by zero
dlang.org bugs
- Bugzilla 16592: Building dlang.org does not work without a preexisting dmd installation
- Bugzilla 16948: broken links in std.stdio due to inccorrect use of WEB macro
dlang.org enhancements
- Bugzilla 8799: Give example of Tuple mapped to a function
- Bugzilla 16147: Provide shiny 404 error pages
Tools regressions
- Bugzilla 14296: RDMD fails at building a lib when the source is in a subdir
- Bugzilla 16962: rdmd --build-only --force -c main.d fails: ./main: No such file or directory
- Bugzilla 16978: [REG2.072.0] pragma(lib) is broken with rdmd
Tools bugs
- Bugzilla 16966: rdmd: AssertError@rdmd.d(489): should have been created by compileRootAndGetDeps
Tools enhancements
- Bugzilla 16593: Building "tools" produces deprecation warnings