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: [email protected]
          Reporter: [email protected]

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!!

--

Reply via email to