[Issue 18545] New: Casting away const with cast() triggers alias this, but returns the supertype anyway
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 1 16:52:58 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18545
Issue ID: 18545
Summary: Casting away const with cast() triggers alias this,
but returns the supertype anyway
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
const Nullable!string a;
Nullable!string b = a; /* This works. */
Nullable!string c = cast() a; /* This asserts in get. */
// Alright, so I guess cast() mistakenly follows the alias this?
// No!
static assert(is(typeof(cast() a) == Nullable!string));
// It follows the alias get this in Nullable, but it returns a Nullable anyway.
// Why!!
--
More information about the Digitalmars-d-bugs
mailing list