digitalmars.D.bugs - [Issue 18545] New: Casting away const with cast() triggers alias
- d-bugmail puremagic.com (23/23) Mar 01 2018 https://issues.dlang.org/show_bug.cgi?id=18545
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 puremagic.com Reporter: default_357-line 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!! --
Mar 01 2018