Beta 2.094.0

Paul Backus snarwin at
Sat Sep 12 13:03:29 UTC 2020

On Saturday, 12 September 2020 at 11:43:03 UTC, MoonlightSentinel 
> Currently looking into enabling it by default but it showed an 
> interesting side effect. The frontend can now conclude that a 
> == b is always true if a and b are instances of an empty struct 
> (without custom opEquals).
> This caused "unreachable code" warnings for VariantN in Phobos 
> and could probably affect other projects as well.

How many improvements does this warning have to block before we 
decide its value for the language is net-negative?

GCC doesn't have it. [1] Clang has it, but only if you 
specifically ask for it with -Wunreachable-code; it's not part of 
-Wall or -Wextra. [2] Rust has it, but lets you turn it off with 
an annotation. [3] Java has it, but it explicitly does *not* take 
constant-folding into account. [4]

The only language I could find that follows D's approach is C# 
[5], and C#'s generics don't get a separate semantic analysis for 
each concrete type like D's templates do.


More information about the Digitalmars-d-announce mailing list