snarwin at gmail.com
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.  Clang has it, but only if you
specifically ask for it with -Wunreachable-code; it's not part of
-Wall or -Wextra.  Rust has it, but lets you turn it off with
an annotation.  Java has it, but it explicitly does *not* take
constant-folding into account. 
The only language I could find that follows D's approach is C#
, 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