Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Forums
  - IRC
  - Community Discord
  - 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.096.0

Download D 2.096.0
released Mar 11, 2021

2.096.0 comes with 17 major changes and 81 fixed Bugzilla issues. A huge thanks goes to the 54 contributors who made 2.096.0 possible.

#### Compiler changes

1. D ABI change on x86_64 Posix targets
2. Added __c_complex_float, __c_complex_double, and __c_complex_real types
3. Having both a copy constructor and a generated postblit is now deprecated
4. DMD's JSON output will now always include the protection level
5. DMD's JSON output now have distinct types for [shared] module constructor/destructor
6. Deprecate local templates that receive local symbols by alias
7. Improvements for the C++ header generation
8. Add -gdwarf=<version> switch for the DMD compiler.
9. Introduced __traits(getVisibility, Sym) as an alias to getProtection
10. Plain synchronized statements now use run-time allocated mutexes.
11. Allow shortened function implementations for single-expression functions.

#### Runtime changes

1. The druntime option callStructDtorsDuringGC has been removed
2. FreeBSD declarations from statvfs that belong in mount have been removed
3. Experimental llvm-libunwind based backtrace printing was added

#### Library changes

1. Deprecate std.math : approxEqual

#### Dub changes

1. More 'linker dflags' with DMD
2. copyFiles can now be used in VisualD projects.

List of all bug fixes and enhancements in D 2.096.0.

#### Compiler changes

1. D ABI change on x86_64 Posix targets

   The compiler has been updated to return the real part of creal numbers in ST0, and the imaginary part in ST1, to match the x86_64 System V ABI.

   This is an ABI breaking change and requires recompiling libraries that make use of the creal type.

2. Added __c_complex_float, __c_complex_double, and __c_complex_real types

   This allows code interfacing with C and C++ to maintain ABI compatibility with _Complex types. It replaces the built-in types cfloat, cdouble, and creal which are due to be deprecated.

3. Having both a copy constructor and a generated postblit is now deprecated

   Up until this release, the postblit had priority over the copy constructor, no matter if the former was user-defined or generated. This prevented new code that uses the copy constructor to interact with library code that uses the postblit. To enable this interaction, having a generated postblit and a copy constructor (user-defined or generated) is now deprecated. For example:

       // library code using postblit
       struct A
       {
           this(this) {}
       }

       // new code using copy constructor
       struct B
       {
           A a;
           this(const scope ref B) {}
       }

   Up until this release, in the above code, struct B had a generated postblit that had priority over the user defined copy constructor. With this release, a deprecation will be issued at the definition of structB, stating that the postblit is going to be preferred to the copy constructor. If B has both a user-defined postblit and a copy constructor (generated or user-defined), the postblit will continue to have priority.

   To get rid of the deprecation, the user can either:

   1. Explicitly @disable this(this) in struct B. That will instruct
   the compiler that the copy constructor is preferred over the postblit.

   2. Define a postblit for struct B. That will instruct the compiler
   that the postblit is preferred over the postblit.

   3. Remove all copy constructors from struct B. In this case the postblit
   will be used for copy constructing instances of struct B.
4. DMD's JSON output will now always include the protection level

   In previous release, the JSON output the compiler generates did not include the protection level if it was public. It is now always included.

5. DMD's JSON output now have distinct types for [shared] module constructor/destructor

   Previously, module constructors and destructors (shared or not) would be output as functions, and the only way for documentation generators to recognize them was to search for the pattern that was used for their naming. This means that external tools would need to depend on internal compiler details for generating documentation. From this release, 4 new values have been introduced for kind: shared static constructor, shared static destructor, static constructor, static destructor.

6. Deprecate local templates that receive local symbols by alias

   Support for instantiating local and member templates with local symbols was implemented in DMD 2.087.0. However, the implementation was incompatible with GDC and LDC backends.

   In order to maintain feature parity among D implementations, this improvement has been deprecated, and may be removed from a future DMD release.

7. Improvements for the C++ header generation

   The following features/bugfixes/improvements were implemented for the experimental C++ header generator:

   - Generate fieldwise constructors for aggregates
   - Don't emit instantiated classes as unique class declarations
   - Emit template arguments for instantiated base classes
   - Don't emit enums for opaque types specially handled by the compiler

   Note: The header generator is still considerer experimental, so please submit any bugs encountered to the bug tracker.

8. Add -gdwarf=<version> switch for the DMD compiler.

   Emit DWARF symbolic debug info (non-Windows machines only). Supported versions are 3, 4, and 5.

   Once added, the -g switch is implicitly activated.

   Note: DWARF Version 5 is experimental.

9. Introduced __traits(getVisibility, Sym) as an alias to getProtection

   Since the changes in v2.071.0, attributes such as private, protected, public, etc... are visibility attributes, and not protection attributes. However, the name of this trait predates such change and was thus inconsistent with all the other documentation. This change only introduce the new name, and getProtection has been left un-deprecated, and while using the new name is reccommended for users that only supports the latest version of the language, there is no plan to deprecate it.

10. Plain synchronized statements now use run-time allocated mutexes.

    Synchronized statements have two forms, synchronized and synchronized(exp). When there is no expression argument, a global mutex is created using a static buffer big enough to store the platform dependant critical section type and a pointer field.

    Example:

        void main()
        {
            synchronized {
                // __gshared byte[40 + 8] __critsec;
                // _d_criticalenter(&__critsec[0]);
                // scope(exit) _d_criticalexit(&__critsec[0]);
                (cast() counter) += 1;
            }
        }

    This implementation suffers from a couple deficiencies. Neither the size nor alignment of the critsec buffer are obtained from the OS critical section type defined in druntime. As a result, if the size allocated by the compiler is too small, or the platform has strict alignment requirements, then the program run-time will crash on entering the synchronized statement.

    This code will now call a new implementation that allocates the critical section lazily at run-time, moving all logic out of the compiler to druntime.

11. Allow shortened function implementations for single-expresssion functions.

    -preview=shortenedMethods is added. This allows functions to be written in a similar form to lambda functions:

        // these 2 are equivalent
        int foo() { return 1; }
        int foo() => 1;

    The syntax allows the form => expr to replace the function body { return expr; }

#### Runtime changes

1. The druntime option callStructDtorsDuringGC has been removed

   It had been deprecated in 2.088.

2. FreeBSD declarations from statvfs that belong in mount have been removed

   It had been deprecated in 2.082 in favor of core.sys.freebsd.sys.mount.

3. Experimental llvm-libunwind based backtrace printing was added

   Currently, druntime uses the backtrace and backtrace_symbols functions to provide debug informations (addresses and function names, respectively).

   This can create issues for target that do not provide backtrace, such as Musl libc. Additionally, the backtrace interface is inherently limited, as it only allow to get up to X frames (where X is the size of the buffer), and forces them to be stored continuously in memory. The same apply to backtrace_symbols.

   On the other hand, libunwind is an industry standard for unwinding and stack trace inspection. It has been ported to a variety of platform, has a simple yet flexible API, and is part of GCC, and a similar library is part of LLVM.

   Starting from this release, druntime includes a way to use LLVM's libunwind as a backtrace provider. The support is limited to LLVM's version of libunwind, as it is available on Alpine Linux, and easier to interface with.

   For packagers, one can define DRuntime_Use_Libunwind when building druntime, enabling the support by default.

#### Library changes

1. Deprecate std.math : approxEqual

   The template approxEqual for comparing floating point numbers has been deprecated.

   Please use the template isClose instead, which has better default values and is symmetric in its arguments.

   To (almost) keep the current behaviour of approxEqual(a, b) use isClose(a, b, 1e-2, 1e-2), but we recommend to adjust the code to make it work with isClose(a, b).

#### Dub changes

1. More 'linker dflags' with DMD

   -betterC, -L… and -Xcc=… dflags are now used for linking too.

2. copyFiles can now be used in VisualD projects.

   Files that are needed for the application to run can be specified in the copyFiles build option, which causes these files to be copied to the target path. The dub generator for VisualD now replicates this behaviour, so that this kind of applications can be successfully debugged in Visual Studio.

List of all bug fixes and enhancements in D 2.096.0:

#### DMD Compiler regression fixes

1. Bugzilla 20661: opEquals not recognized for AA key (take two)
2. Bugzilla 21319: DMD crashes on immutable circular reference
3. Bugzilla 21547: Order of constructor declaration affects struct initializer
4. Bugzilla 21678: "_d_arraysetlengthT is not callable using argument types" on chained array length assignment
5. Bugzilla 21696: DMD 2.095.1 Compilation Crash

#### DMD Compiler bug fixes

1. Bugzilla 5713: Broken final switch on ints
2. Bugzilla 10619: Wrong local variable passed as alias arguments to templates
3. Bugzilla 11717: CTFE: non-constant value with array and vector ops.
4. Bugzilla 13667: ICE: stack overflow using self-referencing cast inside recursive alias this method
5. Bugzilla 14831: Each function local symbols should have unique mangled name
6. Bugzilla 15225: cannot overload directly aliased function literals
7. Bugzilla 16635: Alias this for implicit conversion to "ref const(typeof(this))" causes dmd to segfault
8. Bugzilla 17105: [ICE] SIMD Internal error with optimizations: backend\cod3.c 6807
9. Bugzilla 18867: backend/cgcod.c crash on assignment to vector element
10. Bugzilla 19788: compiler crash on slicing a enum typed as vector
11. Bugzilla 20041: CTFE incorrect result with __vector
12. Bugzilla 20111: asm VCVTPS2PH is not encoded correctly
13. Bugzilla 20235: C++ ABI doesn't destruct struct arguments in the callee
14. Bugzilla 20565: Local template declarations in different scopes produce uncaught name collisions
15. Bugzilla 20695: Copy constructor disable default struct constructor
16. Bugzilla 20821: Aliased template method confuses overload resolution
17. Bugzilla 20868: DIP1000: scope delegate triggers error in unsafe code and it shouldn't
18. Bugzilla 21214: simd: wrong diagnostic with unsupported vectors
19. Bugzilla 21352: enum members should not be given UDAs of its parent enum declaration
20. Bugzilla 21469: ICE core.simd when implementing _mm_set1_epi16
21. Bugzilla 21471: Backend assertion triggered with -checkation=context and -inline
22. Bugzilla 21472: -checkaction=context doesn't work with tupleof
23. Bugzilla 21474: ICE with core.simd and -O (Illegal Instruction)
24. Bugzilla 21481: functions in overloaded template are lost when the template overloads an alias
25. Bugzilla 21489: Duplicated template instantiation using mixin inside alias declaration
26. Bugzilla 21490: Optimizer can add SSE integer multiply for machines less than SSE4.1 which do not have it
27. Bugzilla 21501: [REG 2.089.1] undefined identifier in package when using mixin and cyclic imports
28. Bugzilla 21508: private class p in file p.d visible outside the file (module)
29. Bugzilla 21515: extern(C) and extern(C++) returns creal in wrong order
30. Bugzilla 21518: delegates not checked for attribute match in const arrays
31. Bugzilla 21522: function gets lost when aliasing an overloaded function template
32. Bugzilla 21526: x87 not rounding to precision on assignment on some platforms
33. Bugzilla 21530: dtoh: Identifiers need to be sanitized wrt. reserved C++ keywords
34. Bugzilla 21534: dtoh: Default params for default ctor missing template args
35. Bugzilla 21543: dmd infinite loop on alias this and std.typecons.Nullable
36. Bugzilla 21553: incorrect call to expressionSemantic() in statementsem.d
37. Bugzilla 21598: checkaction=context reruns pure functions with debug blocks on failure
38. Bugzilla 21640: @live not working with templates
39. Bugzilla 21647: pragma(msg) should be able to print a void type
40. Bugzilla 21659: [OSX] core.stdc.config.__c_ulonglong is forward referenced while looking for sizeof
41. Bugzilla 21662: Extern linkage variables cannot be of types with disabled default construction
42. Bugzilla 21668: Cannot declare ref parameter of opaque type
43. Bugzilla 21682: checkaction=context fails for expressions using static operator overloads

#### DMD Compiler enhancements

1. Bugzilla 7176: Lambda => syntax for function and methods too
2. Bugzilla 10445: add .min, .max, etc. properties for vector types
3. Bugzilla 19632: [SIMD] Error: invalid foreach aggregate
4. Bugzilla 20788: Difference between colored and non colored output
5. Bugzilla 21527: Unnecessary store to memory in SIMD code
6. Bugzilla 21593: Only update file time if file to be written already exists

#### Phobos regression fixes

1. Bugzilla 21663: std.concurrency.receiveOnly doesn't work with tuples

#### Phobos bug fixes

1. Bugzilla 13663: Comparison of Tuples with floating point fields
2. Bugzilla 15136: If we want toStringz to be fully correct, it needs to stop checking for '\0'
3. Bugzilla 17269: formattedWrite of struct with Nullable string fails
4. Bugzilla 20508: std.math.pow(-infinity, y) does not return NaN for imaginary or complex results
5. Bugzilla 20539: std.conv.to: internal overload conflict for enums with base types that have a catch-all opEquals overload (?)
6. Bugzilla 20848: Bug in formatValueImpl
7. Bugzilla 21103: isDynamicArray instantiates unecessary templates
8. Bugzilla 21444: bad string concat in static assert message
9. Bugzilla 21555: std.container.array: insertBack is wrong and should be tested for Array!bool
10. Bugzilla 21556: std.container.array: insertAfter is wrong and should be tested
11. Bugzilla 21609: LinearCongruentialEngine fails for m = 0
12. Bugzilla 21634: std.bitmanip: bitfields may generate invalid variable
13. Bugzilla 21635: std.bitmanip: bitfields should produce better error messages with wrong parameters
14. Bugzilla 21636: std.bitmanip: bitfields size of bitfield should be checked against size of used type

#### Phobos enhancements

1. Bugzilla 21523: Microsoft Windows std.stdio.File.lock(), tryLock(), unlock(): do not allocate memory for error messages when they are not needed
2. Bugzilla 21559: Speed up walkLength for narrow strings
3. Bugzilla 21629: std.csv report one record on empty input
4. Bugzilla 21638: std.typecons.RefCounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with @disable

#### Druntime regression fixes

1. Bugzilla 21309: Missing core.thread.threadbase documentation
2. Bugzilla 21642: [REG 2.084] hashOf will fail to compile for some structs/unions that recursively contain shared enums

#### Druntime bug fixes

1. Bugzilla 8046: simd.d needs some documentation
2. Bugzilla 21544: -checkaction=context formats enum members as their base type
3. Bugzilla 21666: wrong printf format specifier for real with -checkaction=context on Win64

#### Druntime enhancements

1. Bugzilla 14790: coverage merge should detect changed source code

#### dlang.org bug fixes

1. Bugzilla 21292: Chrome by default now blocks downloading .dmg or .exe files via HTTP
2. Bugzilla 21493: Documentation broken hyperlink std.stdio

### Contributors to this release (54)

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

- Adam D. Ruppe
- aG0aep6G
- Andrei Alexandrescu
- Atila Neves
- Bartosz Wójcik
- Basile Burg
- Bastiaan Veelo
- Ben Jones
- Bernhard Seckinger
- berni42
- berni44
- Boris Carvajal
- brianush1
- Cameron Ross
- Crom (Thibaut CHARLES)
- Denis Feklushkin
- dkorpel
- Eugen Wissner
- Florian
- H. S. Teoh
- Hiroki Noda
- Iain Buclaw
- Jacob Carlborg
- Lucien Perregaux
- Luhrel
- Luís Ferreira
- Martin Kinkelin
- Martin Nowak
- Mathias Lang
- Mathis Beer
- mhh
- Mihaela Chirea
- Mike Parker
- MoonlightSentinel
- Nathan Sashihara
- Nicholas Wilson
- nordlow
- Paul Backus
- Petar Kirov
- Quirin F. Schroll
- Razvan Nitu
- rkulhanek
- Robert burner Schadek
- Roman Kashitsyn
- Roy Margalit
- Sebastian Wilzbach
- Stefan Koch
- Steven Schveighoffer
- Tim Schendekehl
- Tomáš Chaloupka
- Vladimir Panteleev
- Walter Bright
- Witold Baryluk
- سليمان السهمي (Suleyman Sahmi)

Copyright © 1999-2023 by the D Language Foundation | Page generated by Ddoc on Wed Mar 1 14:57:14 2023