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

Download D 2.083.0
released Nov 01, 2018

2.083.0 comes with 11 major changes and 47 fixed Bugzilla issues. A huge thanks goes to the 51 contributors who made 2.083.0 possible.

#### Compiler changes

1. Add CppRuntime_* version identifiers.
2. Deprecated CLI switch -gc have been removed
3. Expose __traits(isZeroInit, T)
4. Implement new C++ mangling syntax
5. Add pragma(linkerDirective), to emit linker directives into object files.
6. fix Issue 14246 - RAII - proper destruction of partially constructed objects
7. Add __traits(getTargetInfo, "key") to query details about the compilation target.

#### Library changes

1. std.algorithm.iteration.each is now capable of early-stopping
2. toHash function has been added to std.experimental.checkedint.Checked

#### Dub changes

1. betterC build option has been added
2. Environment variable DUB_PACKAGE_VERSION added

List of all bug fixes and enhancements in D 2.083.0.

#### Compiler changes

1. Add CppRuntime_* version identifiers.

   In order to link against C++ code, it is important to know what C++ runtime the ABI targets.

   Supported version identifiers include:

   - CppRuntime_Clang
   - CppRuntime_DigitalMars
   - CppRuntime_Gcc
   - CppRuntime_Microsoft
   - CppRuntime_Sun

   The C++ runtime in use generally depends on the C++ compiler used to build the C++ code that will be linked against. This is contrast to the C runtime, which generally depends on the target system.

2. Deprecated CLI switch -gc have been removed

   This switch was deprecated in v2.075.0 and is now removed, meaning DMD will complain about an unrecognized switch. -gc used to pretend to be C, but debuggers have been D-aware for around a decade.

3. Expose __traits(isZeroInit, T)

   Takes one argument which must be a type. If the type's default initializer has no non-zero bits then true is returned, otherwise false. isZeroInit will always return true for a class C because C.init is a null reference.

   This property was already being computed internally by the compiler so exposing it via __traits is more efficient than re-implementing it in library code.

       struct S1
       {
           int x;
       }

       struct S2
       {
           int x = -1;
       }

       static assert(__traits(isZeroInit, S1));
       static assert(!__traits(isZeroInit, S2));

       void test()
       {
           int x = 3;
           static assert(__traits(isZeroInit, typeof(x)));
       }

4. Implement new C++ mangling syntax

   The new syntax allows for keywords to be used for mangling and only changes the mangle of a symbol. It does not provide any feature resembling C++ namespaces. This allows users to structure their C++ in traditional D fashion, utilizing modules. The old syntax extern(C++, foo) would occupy the symbol foo. This meant modules couldn't use this name and match the C++ namespace.

       extern(C++, "__traits") void foo();

       extern(C++, "std", "chrono") void bar(); // multiple namespace syntax

       int std; // no symbol clashing with above extern(C++, "std", ...)

5. Add pragma(linkerDirective), to emit linker directives into object files.

   Emits a custom linker directive to the object file, eg:

       pragma(linkerDirective, "/alternatename:_pWeakValue=_pDefaultWeakValue");

   This is only supported for MS-COFF output.

6. fix Issue 14246 - RAII - proper destruction of partially constructed objects

   Since destructors for object fields can now get called by the constructor for that object if the constructor fails, the attributes of the destructors must be covariant with the attributes for the constructor.

   I.e. if the constructor is marked @safe, the fields' destructors must also be @safe or @trusted.

   Since this behavior was never checked before, this fix causes breakage of existing code. Hence, enabling this behavior is behind the new transition=dtorfields compiler switch. It will eventually become the default behavior, so it is recommended to fix any of these destructor attribute issues.

7. Add __traits(getTargetInfo, "key") to query details about the compilation target.

   getTargetInfo accepts a string key as argument to select the target detail of interest.

       static if (__traits(getTargetInfo, "cppRuntimeLibrary") == "msvcrtd") { ... }

       static assert (__traits(getTargetInfo, "not_a_target_info") == "??"); // <- error: no such targetInfo "not_a_target_info"!

   getTargetInfo keys are implementation defined, allowing relevant data for exotic targets. A reliable subset which are always available shall be mentioned in the spec.

#### Library changes

1. std.algorithm.iteration.each is now capable of early-stopping

   std.algorithm.iteration.each is now capable of exiting early. When a No.each std.typecons.Flag is returned from the function that is called by each, the iteration will be aborted early. Analogously, returning Yes.each will continue the iteration. For example:

       auto arr = [10, 20, 30];
       arr.each!((n) { arr ~= n; return (n == 20) ? No.each : Yes.each; }); // aborts after the second iteration
       assert(arr == [10, 20, 30, 10, 20]);

2. toHash function has been added to std.experimental.checkedint.Checked

   Custom hashing can be implemented in a Hook. If no hashing is specified, then the built-in function will be used. Checked can now be used with associative arrays.

       import std.experimental.checkedint;

       static struct MyHook
       {
           static size_t hookToHash(T)(T payload)
           {
               auto h = typeid(payload).getHash(&payload);
               return h + 0x9e3779b9 + (h << 6) + (h >> 2);
           }
       }

       auto h = checked!MyHook(142).toHash();

#### Dub changes

1. betterC build option has been added

   This build option can be used to pass -betterC argument to DMD or LDC:

   dub.json:

       "buildOptions": ["betterC"]

   dub.sdl:

       buildOptions "betterC"

2. Environment variable DUB_PACKAGE_VERSION added

   When executing external commands, DUB will now set the environment variable DUB_PACKAGE_VERSION. The variable will contain the version of the package being built, as it appears in the output of dub describe.

   One application of this addition is to use a pre-build command to save the package version to a source file, in order to compile the version string into the application being built.

List of all bug fixes and enhancements in D 2.083.0:

#### DMD Compiler regressions

1. Bugzilla 19248: Wrong mangle for C++ const STL classes/structs
2. Bugzilla 19304: [Reg 2.081.0] Linker arguments order changed in issue 15574 hinders using --whole-archive linker directive

#### DMD Compiler bugs

1. Bugzilla 11538: [ICE] stack overflow with recursive NullableRef fails
2. Bugzilla 14246: RAII - proper destruction of partially constructed objects/structs
3. Bugzilla 15374: [internal] Nothing should import ddmd.mars
4. Bugzilla 18457: betterC - struct destructor is always called at function return
5. Bugzilla 18771: Identical overload sets in different modules have different identities
6. Bugzilla 18955: extern(C++) default struct mangling is overridden when interacting with a cppmangle = class template
7. Bugzilla 19098: Improve error for non-assignable struct
8. Bugzilla 19181: Semantic errors in opDispatch argument lead to "no property X"
9. Bugzilla 19182: missing semicolon crashes compiler
10. Bugzilla 19185: [ICE] Nested struct segfaults when using variable from outer scope
11. Bugzilla 19201: Error: func called with argument types (ulong) matches both: __c_long and __c_ulong
12. Bugzilla 19209: [ICE] Overriding a field in a baseclass issues an ICE
13. Bugzilla 19225: Confusing error message on static else
14. Bugzilla 19251: Alias this does not get called on struct qualified type
15. Bugzilla 19284: alias this not used in nested functions of a method

#### DMD Compiler enhancements

1. Bugzilla 15512: extern(C++, ns) should consider taking a string
2. Bugzilla 19180: Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T)
3. Bugzilla 19194: version for -mscrtlib specification
4. Bugzilla 19195: Support pragma to specify linker directives
5. Bugzilla 19199: Use core.bitops intrinsics during CTFE
6. Bugzilla 19203: alias this to a bool behaves both inconsistently and incorrectly with static assert
7. Bugzilla 19212: Add versions for C++ runtimes.
8. Bugzilla 19292: Mixin expressions should take an argument list the same as pragma(msg) does

#### Phobos bugs

1. Bugzilla 11431: std.file.slurp fails with Windows newlines
2. Bugzilla 11959: Phobos should not declare public symbols in version(unittest) blocks
3. Bugzilla 17276: BaseClassesTuple fails on extern C++ classes that implement an interface without a base class
4. Bugzilla 18675: std.experimental.checkedint.Checked has opEquals but no toHash
5. Bugzilla 18683: std.containers.rbtree.RedBlackTree has opEquals but no toHash
6. Bugzilla 18838: Formatting the number zero with separator doesn't obey width specifier
7. Bugzilla 19085: std.experimental.allocator.makeArray should work with void
8. Bugzilla 19200: Variant operators don't overload correctly
9. Bugzilla 19228: hasAliasing fails on static arrays
10. Bugzilla 19240: std.typecons.Tuple should check for reserved identifiers
11. Bugzilla 19275: std.process: redirecting output in a non-console application fails
12. Bugzilla 19289: std.range.transposed with enforceNotJagged not throwing
13. Bugzilla 19297: JSONValue of signed and unsigned equal values is not equal

#### Phobos enhancements

1. Bugzilla 18142: checkedint opOpAssign doesn't accept a checkedint
2. Bugzilla 19236: Replace runtime typeid(T).initializer().ptr is null checks with compile-time __traits(isZeroInit, T)
3. Bugzilla 19257: std.array.join does not handle const fields that cannot be converted to mutable

#### Druntime bugs

1. Bugzilla 19250: DWARF Backtraces with very long symbol names read out of bounds when printing
2. Bugzilla 19262: hashOf associative array should infer nothrow
3. Bugzilla 19282: hashOf segfaults for non-null C++ objects
4. Bugzilla 19314: Thread object destruction may result in UB

#### Druntime enhancements

1. Bugzilla 19280: Remove unnecessary error checks in core.time.currSystemTick and currTime

#### dlang.org bugs

1. Bugzilla 18104: Alias example compiles where it states that it should be illegal

### Contributors to this release (51)

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

- 0xEAB
- aG0aep6G
- Alexandru ermicioi
- Andrei Alexandrescu
- Arun Chandrasekaran
- Basile Burg
- BBasile
- Carsten Schlote
- devel
- deviator
- dhasenan
- Diederik de Groot
- Dragos Carp
- Erik van Velzen
- Eugen Wissner
- GoaLitiuM
- Iain Buclaw
- Ilya Yaroshenko
- Ionut
- Joakim Noah
- Johannes Loher
- Johannes Pfau
- Jonathan M Davis
- kinke
- look-at-me
- Manu Evans
- Martin Nowak
- Mathias Lang
- Mathis Beer
- Mihails Strasuns
- Mike Franklin
- Mike Parker
- Márcio Martins
- Nathan Sashihara
- Nicholas Lindsay Wilson
- Nicholas Wilson
- Petar Kirov
- Pjotr Prins
- Rainer Schuetze
- Razvan Nitu
- Ryan David Sheasby
- Sebastian Wilzbach
- shove70
- Simen Kjærås
- Steven Schveighoffer
- Thomas Mader
- Vlad Vitan
- Vladimir Panteleev
- Walter Bright
- wolframw
- Ľudovít Lučenič

Copyright © 1999-2023 by the D Language Foundation | Page generated by Ddoc on Sat Jul 15 12:03:54 2023