Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
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.068.0

Download D 2.068.0
released Aug 09, 2015

#### Compiler Changes

1. Warning: Change in helper function generation might cause link error.
2. The new -profile=gc switch enables profiling memory allocation.
3. unittest blocks no longer parsed unless -unittest is specified.
4. Compiler generated inclusive destructor and postblit functions for UDTs are now accessible as .__xdtor and .__xpostblit, see dmd#4650.

#### Language Changes

1. pragma(inline) was added.
2. attribute inference for auto functions
3. Indexed type tuples can now be followed by dot identifiers.
4. Support template parameter deduction from function default arguments.
5. Invalid reinterpret casts can be detected in the frontend.

#### Library Changes

1. Many phobos functions were rangified.
2. std.typetuple was renamed to std.meta but a backwards compatible forwarding module will remain.
3. TypeTuple was renamed to AliasSeq but a backwards compatible alias will remain.
4. hexString was added to replace core language hex strings.
5. hasUDA was added to help check for the existence of user-defined attributes on symbols.
6. GC API calls can now be profiled separately.
7. The runtime implementations of synchronized and synchronized (obj) were rewritten to fix a race condition during mutex initialization, see druntime#1274.
8. The handwritten object.di header was replaced by directly using the object.d source file, see druntime#1222 for more details.
9. The AA implementation now uses open addressing.
10. Merging code coverage reports was fixed, see Bugzilla 14464 and dmd_coverSetMerge.
11. executeShell now ignores the SHELL environment variable and always uses sh, see Bugzilla 14282.
12. byLine was improved to use getdelim where available and is now up to 3x faster, see Bugzilla 11810.
13. The newly added ordered and strictlyOrdered can be used to test whether a few given values are ordered.
14. RefCounted uses the new return attribute to enable escape checking for its payload.

List of all bug fixes and enhancements in D 2.068.

#### Compiler Changes

1. Warning: Change in helper function generation might cause link error.

   In order to fix Issue 14828 compiler helper functions for array bounds checking and assert are now generated only once when a module is compiled, not everytime they are used. This may lead to link errors when using a module without compiling and linking against it.

   If you encounter link errors like

       undefined reference to '_D5mylib5mymod7__arrayZ'

       undefined reference to '_D5mylib5mymod8__assertFiZv'

       undefined reference to '_D5mylib5mymod15__unittest_failFiZv'

   then you're not compiling and/or not linking the module mylib.mymod.
2. The new -profile=gc switch enables profiling memory allocation.

   When compiling with -profile=gc dmd will instrument GC allocations to be traced by the runtime. The runtime accumulates the traces and writes a report to the file profilegc.log upon program termination.

   Example:

       bytes allocated, type, function, file:line
            171        immutable(char)[] example.concat example.d:4
             24        closure D main example.d:18
             16        example.Klass D main example.d:20

   Note: GC allocations using the core.memory interface are not profiled.

3. unittest blocks no longer parsed unless -unittest is specified:

   When the unittest code is not necessary, it will be merely analyzed as the tokens enclosed with paired braces, to speed up compilation.

       unittest { auto r = test(); assert(r); }
       // If you don't specify -unittest, no AST generated for the unittest block.

       unittest { the contents is just ignored. }
       // Since 2.067: this had caused parsing error.
       //  From 2.068: no error happens, because it's equivalent with:
       enum unittest_code = q{ the contents is just ignored. };

#### Language Changes

1. pragma(inline) was added:

   A new pragma was added for more fine-grained control of inlining. It must be used together with the -inline switch.

       pragma(inline, true) // errors if function isn't inlined
       int double(int val) { return 2 * val; }

       pragma(inline, false) // never inline
       int double(int val) { return 2 * val; }

   Read the documentation for more details.

2. Attributes for auto return function are now inferred.

   Just like templated functions, functions with an auto return type must always have a function body. The compiler was changed to take advantage of this fact and now also infers attributes for them.

       auto foo()() {} // template function
       auto bar() {}   // non-template function without return type
       void baz() {}   // non-template function with return type

       static assert(is(typeof(&foo!()) == void function() pure nothrow @nogc @safe));
       static assert(is(typeof(&bar) == void function() pure nothrow @nogc @safe));
       static assert(is(typeof(&baz) == void function()));

3. Indexed type tuples can now be followed by dot identifiers.

   A parsing limitation was lifted and it's now possible to use an indexed type tuple followed by dot identifiers as typename.

       alias TypeTuple(T...) = T;

       struct S
       {
           alias T = int;
           alias U = TypeTuple!(long, string);
       }

       alias Pair = TypeTuple!(S, S);

       struct X(Types...)   // used tuple parameter
       {

           Types[0].T a;     // Types[0] == S, then typeof(a) == S.T == int
           Types[0].U[1] b;  // Types[0].U == S.U, then typeof(b) == S.U[1] == string
       }
       alias x = X!Pair;

4. Support template parameter deduction from function default arguments:

   When performing IFTI templated types can now be deduced from a parameter's default argument. This avoids a redundant and error prone declaration of the default type.

       void previously(T=int)(T t = 0) { } // it was necessary to also specify a default type
       void now(T)(T t = 0) { } // the default type can be deduced from the default argument as int
       void main() { previously(); now(); }

5. Invalid reinterpret casts can be detected in the frontend.

   Invalid reinterpret casts are now detected in the compiler frontend instead of the backend. This allows to check for possible reinterpret casts during compile time and improves the error messages for invalid casts.

       pragma(msg, is(typeof({ void* x; auto y = cast(void delegate())x; })));
       // Since 2.067: it prints 'true'
       //  From 2.068: it prints 'false'

       void test() { void* x; auto y = cast(void delegate())x; }
       // Since 2.067: it had reported internal compiler error "Error: e2ir: cannot cast ..."
       //  From 2.068: it reports proper frontend error.

#### Library Changes

1. Many phobos functions were rangified.

   Many phobos functions that allocated GC memory were changed to support ranges or were complemented by an alternative supporting ranges. Using ranges often eliminates GC allocations.

       setExtension("foo.jpg", ".png"); // allocates a new string
       withExtension("foo.jpg", ".png"); // returns a range without allocating

   Rangified Functions:
   Module | Functions
   --- | ---
   std.algorithm.comparison | levenshteinDistance
   std.path | asAbsolutePath asNormalizedPath asRelativePath chainPath dirName driveName filenameCmp globMatch isValidFilename isValidPath pathSplitter rootName stripExtension withDefaultExtension withExtension
   std.string | centerJustifier chomp chompPrefix chop column detabber entabber indexOf leftJustifier makeTransTable rightJustifier soundexer strip stripLeft stripRight
   std.uni | asCapitalized asLowerCase asUpperCase

2. GC API calls can now be profiled separately.

   The GC option --DRT-gcopt=profile has been enhanced to accept an additional level 2 that allows profiling API calls grouped by most common operations.

   As this instrumentation has an impact on the GC performance even if unused, you have to recompile the GC module with -debug=PROFILE_API, e.g.

       dmd test.d -O -inline -debug=PROFILE_API -Ipath-to-druntime/src path-to-druntime/src/gc/gc.d
       ./test --DRT-gcopt=profile:2

   The profiling summary will then look like this:

           malloc:  9768628 calls, 531 ms
           realloc: 0 calls, 0 ms
           free:    0 calls, 0 ms
           extend:  1100 calls, 0 ms
           other:   826 calls, 0 ms
           lock time: 160 ms
           GC API: 692 ms
       GC summary:   12 MB,   52 GC  331 ms, Pauses  227 ms <    4 ms API  692 ms

   The malloc function includes time for GC collections. Lock time (GC synchronization) is measured separately and not included in the other times.

3. The AA implementation now uses open addressing.

   The runtime implementation for associative arrays was rewritten and now uses open addressing with quadratic probing and triangular numbers. This is much more cache friendly than the old separate chaining implementation and can result in ~25% faster lookups for big AAs. Also see druntime#1229.

   Note: As the allocation pattern changed (the table is bigger, nodes are smaller) you might see a small drop in performance because the GC manages big allocations less efficiently.

List of all bug fixes and enhancements in D 2.068:

#### DMD Compiler regressions

1. Bugzilla 9279: [REG2.055/2.063] Static array return value implicitly converted to immutable dynamic array
2. Bugzilla 12984: [REG2.068a] ICE on forward reference of derived class from other instantiated class
3. Bugzilla 13816: [REG2.066.0] The compiler crashes with recursive tuple expansion
4. Bugzilla 14207: [REG2.065] [CTFE] ICE on unsupported reinterpret cast in compile time
5. Bugzilla 14351: [REG2.063] inout base class constructor can't be called
6. Bugzilla 14390: [REG2.068a] ICE or bad "has forward references" error with circular class structure
7. Bugzilla 14406: [REG2.068a] GIT HEAD ignores forward reference and generates wrong code
8. Bugzilla 14430: [REG2.060] Null parameter is detected as non-null.
9. Bugzilla 14468: [Reg 2.068.0-devel] overload mismatch for template instance with typesafe variadic parameter
10. Bugzilla 14481: [REG2.066] ICE with forward reference of manifest constant on template arguments
11. Bugzilla 14520: [REG2.067.0] string/alias template overload
12. Bugzilla 14528: [REG2.058a] can't pass protected member to template by alias
13. Bugzilla 14546: "ClockType.uptime is not supported by MonoTimeImpl on this system"
14. Bugzilla 14549: isVirtualMethod does not work well with Github DMD
15. Bugzilla 14552: [REG2.066] SIGSEGV with compile construction nested class in predicate
16. Bugzilla 14556: [REG2.067] can't instantiate struct that has constructor and static array of enum
17. Bugzilla 14560: [REG2.058] Strange -inline behavior
18. Bugzilla 14568: [REG2.067] gaggederrors ICE
19. Bugzilla 14571: [REG2.064] Large static arrays seem to lock up DMD
20. Bugzilla 14572: cannot build dmd from source anymore: 'g++ -m64: No such file or directory'
21. Bugzilla 14573: [REG2.067] Extreme memory usage when synchronized( object ) is used
22. Bugzilla 14587: [REG2.064] generated 64 bit code for switch jump tables is wrong
23. Bugzilla 14594: [REG2.068a] DDoc for template functions and structs has disappeared
24. Bugzilla 14606: [REG2.067.0] Bad code with -inline and structs
25. Bugzilla 14609: [REG2.068a] Github HEAD: DMD assertion failure for valid code
26. Bugzilla 14610: [REG2.067] 'null this' assertion missing in 2.067
27. Bugzilla 14634: dmd crashes without any input
28. Bugzilla 14642: [REG2.066] ICE in ctfeInterpret
29. Bugzilla 14666: [REG2.061] Bogus forward reference error
30. Bugzilla 14672: [REG2.067.0] Internal error: e2ir.c 4620 when copying array of derived class to an array of base class
31. Bugzilla 14805: [REG2.064] Unreasonably slow "new Struct[large]"
32. Bugzilla 14806: [REG2.063] alias this doesn't force elaborate equality, but is followed during it
33. Bugzilla 14814: ld: GOT load reloc does not point to a movq instruction
34. Bugzilla 14828: [REG2.067] duplicate symbol __ModuleInfoZ depending on ordering of files passed to dmd
35. Bugzilla 14829: [REG2.066.0] wrong code with -O -inline
36. Bugzilla 14834: [REG 2.068-b2] dirEntries with mask stopped working with "-inline -debug"
37. Bugzilla 14836: [REG2.068a] Multiple variadic template argument trick broken
38. Bugzilla 14838: [REG 2.066] Wrong attribute inference for auto-generated class destructor with static array of non-POD type
39. Bugzilla 14844: [REG2.068a] __traits(allMembers) must not visit yet not instantiated template members
40. Bugzilla 14851: [REG2.068.0-b2] Cannot assign array operation result to static array variable
41. Bugzilla 14853: [REG2.066] DMD segfaults with the cast from mutable struct new to shared
42. Bugzilla 14890: [REG 2.068.0-rc1] Can not construct a RedBlackTree of Tuples

#### DMD Compiler bugs

1. Bugzilla 1759: Closures and With Statements
2. Bugzilla 2803: template + default argument = doesn't work
3. Bugzilla 3869: Unreasonable error without line number: "recursive template expansion"
4. Bugzilla 5770: Template constructor bypass access check
5. Bugzilla 6613: Can't use empty tuple as default value for variadic template function parameter
6. Bugzilla 6766: Forward reference error for default struct/class arguments
7. Bugzilla 8217: static nested class can reference outer scope by template instantiation
8. Bugzilla 8234: symbols used in CTFE affect the function literal type
9. Bugzilla 9023: CTFE: cannot use ~= on an empty AA.
10. Bugzilla 10158: 'offsetof' property of nested struct does not work properly
11. Bugzilla 10282: Refused assignment of vector op result to const array
12. Bugzilla 10492: Illegal Instruction for mixin template with scope declarations
13. Bugzilla 10972: aggregate postblit doesn't clean up in case of failure
14. Bugzilla 11166: Forward reference error when alias of template instance is private
15. Bugzilla 12036: Wrong code with auto-returning function as mixin alias param
16. Bugzilla 12152: Cannot forward reference subclass member in superclass
17. Bugzilla 12406: Broken delegate closure
18. Bugzilla 12603: [CTFE] goto does not correctly call dtors
19. Bugzilla 12799: Forward reference to nested enum with struct.sizeof
20. Bugzilla 12971: Missing REX prefix for 8 bit register access
21. Bugzilla 13270: ddoc can't find parameters of ditto'd function overloads
22. Bugzilla 13920: DMD crash when trying to set a delegate from __traits(getOverloads)
23. Bugzilla 13985: Wrong code when using "super" to call final interface method
24. Bugzilla 14097: root/async.c: use after free
25. Bugzilla 14185: [ICE] [mtype.c] compiler segfault in in Type::aliasthisOf
26. Bugzilla 14243: mixin template scope inconsistency?
27. Bugzilla 14249: Loose error check for incorrect template mixin
28. Bugzilla 14264: Destructor not called when struct is returned from a parenthesis-less function call
29. Bugzilla 14268: Win64: debug info for associative arrays have no type information
30. Bugzilla 14281: duplicate .debug_info entries for arrays, delegates and AAs
31. Bugzilla 14290: is-expression accepts instantiation of already instantiated template
32. Bugzilla 14320: Improve diagnostic message for "undefined identifier" error
33. Bugzilla 14321: Unnecessary destructor call with and AAs
34. Bugzilla 14325: [CTFE] Comparison of AAs makes wrong result
35. Bugzilla 14330: Wrong DWARF type of dynamic array variable
36. Bugzilla 14343: Postfix increment doesn't work on structs with immutable member
37. Bugzilla 14348: typeof(x).ident is not accepted as a symbol
38. Bugzilla 14352: Two goto cases in one case branch does not work correctly
39. Bugzilla 14357: Match on specType does not check the conflict with already deduced template arguments
40. Bugzilla 14371: [CTFE] Binary assignment expression makes wrong result in compile-time
41. Bugzilla 14388: ICE with idup-ed struct literal in template argument
42. Bugzilla 14398: Segfault when nested struct in static array accesses context
43. Bugzilla 14407: No protection and attributes check for class/struct allocator in NewExp
44. Bugzilla 14409: false positive "Error: one path skips constructor"
45. Bugzilla 14416: .sizeof yields 1 for uninstantiated struct templates
46. Bugzilla 14425: Indirect template instantiation within is expression causes missing linker symbols
47. Bugzilla 14446: ICE on invalid import
48. Bugzilla 14510: Bad tail call optimization with static arrays
49. Bugzilla 14596: Error: e2ir: cannot cast malloc(42u) of type void* to type char[]
50. Bugzilla 14617: PTHREAD_MUTEX_INITIALIZER does not work on OSX
51. Bugzilla 14629: Type system breaking and wrong code bugs in casting reference types to typeof(null)
52. Bugzilla 14649: ICE on invalid array operation with string literals
53. Bugzilla 14656: "auto" of "auto ref" spills over to other function

#### DMD Compiler enhancements

1. Bugzilla 9914: Do attribute inference for auto functions
2. Bugzilla 11003: Improve .di generation
3. Bugzilla 14465: CTFE exception stacktrace shows location of Exception constructor
4. Bugzilla 14547: Ddoc should prefer new Variable Template syntax

#### Phobos regressions

1. Bugzilla 14712: GIT HEAD : std.net.curl regressions
2. Bugzilla 14748: Removing std.stdio import causes 2x increase in "Hello, world" program binary filesize
3. Bugzilla 14765: [Reg2.068.0] Rangified functions no longer accept types that implicitly cast to string
4. Bugzilla 14842: [REG 2.068-b2] approxEqual does not work with integers
5. Bugzilla 14881: [REG] posix.mak omits package.d files when building zip file

#### Phobos bugs

1. Bugzilla 12702: [FixIncluded] std.container.RedBlackTree's in operator is not const
2. Bugzilla 13534: std.variant can violate memory safety
3. Bugzilla 14282: executeShell should use sh and ignore the SHELL env variable
4. Bugzilla 14373: std.range.refRange doesn't work on mere input ranges
5. Bugzilla 14408: std.process: Can't start interactive process from Windows GUI application
6. Bugzilla 14422: std.process: Pipes do not append to files on Win64
7. Bugzilla 14469: file.readText on Win64 doesn't work for files > 4GB.
8. Bugzilla 14526: GetOptException DDOC needs cleanup
9. Bugzilla 14544: isForwardRange failed to recognise valid forward range
10. Bugzilla 14575: compile error with std.range.refRange when front/back isn't implicitly convertible from const to mutable
11. Bugzilla 14585: destructor called on garbage in std.variant

#### Phobos enhancements

1. Bugzilla 14194: nothrow emplace for classes needed
2. Bugzilla 14288: std.windows.registry should use std.windows.syserror
3. Bugzilla 14289: WindowsException should not attempt to parse code 0
4. Bugzilla 14368: stdio.rawRead underperforms stdio
5. Bugzilla 14432: move construction for RefCounted
6. Bugzilla 14457: Algebraic does not allow assignment from subset type
7. Bugzilla 14535: std.net.curl.CurlException should include status line
8. Bugzilla 14548: std.stdio.File should have sync() method (fsync/FlushFileBuffers wrapper)
9. Bugzilla 14586: can't get an immutable value from a const std.variant.Variant

#### Druntime regressions

1. Bugzilla 14626: [REG2.066] byValue doesn't work with inout AA
2. Bugzilla 14746: [REG2.068a] Behavior change with struct destructor and alias this
3. Bugzilla 14863: CLOCK_BOOTTIME should be optional to support <2.6.39 kernels

#### Druntime bugs

1. Bugzilla 6607: critical_.d and critical.c use double check locking the wrong way
2. Bugzilla 12289: incorrect core.stdc.stdio.fpos_t alias
3. Bugzilla 14350: Unit test failures are not displayed in Windows GUI programs
4. Bugzilla 14401: typeid(shared X).init is empty for class types
5. Bugzilla 14423: struct destructors not finalized for AA values
6. Bugzilla 14464: coverage merge doesn't work
7. Bugzilla 14476: core.thread unit tests failing on FreeBSD 9+
8. Bugzilla 14511: Profiler does not work with multithreaded programs
9. Bugzilla 14565: dmd -profile produces garbled output for long-running CPU-intensive processes

#### Druntime enhancements

1. Bugzilla 12891: add atomicFetchAdd and atomicFetchSub to core.atomic
2. Bugzilla 14385: AA should use open addressing hash

#### dlang.org bugs

1. Bugzilla 12803: __traits(getFunctionAttributes) is not documented
2. Bugzilla 13527: ddoc website documentation does not match the current built-in symbols
3. Bugzilla 14079: Variable templates' documentation not generated.
4. Bugzilla 14080: No mention of documented unittests on ddoc's page
5. Bugzilla 14326: syntax highlighting of dpl-docs no longer works
6. Bugzilla 14418: D-style Variadic Function example does not compile

#### Tools bugs

1. Bugzilla 13758: RDMD renames directory if -ofNAME is the name of a directory
2. Bugzilla 14259: rdmd: --build-only / -of / -od incompatible with --dry-run

#### Installer bugs

1. Bugzilla 14801: OS X installer not compatible with OS X 10.11
2. Bugzilla 14864: windows uninstall during installation pops up spurious warning

Copyright © 1999-2019 by the D Language Foundation | Page generated by Ddoc on Sun Sep 1 19:49:09 2019