www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20749] New: Invalid cast of class ref to AA isn't caught

https://issues.dlang.org/show_bug.cgi?id=20749

          Issue ID: 20749
           Summary: Invalid cast of class ref to AA isn't caught
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

This wrongly compiles, then segfaults at runtime:

class Empty {}

void main()
{
    auto e = new Empty;
    auto aa = cast(Empty[string]) e;

    import std.stdio;
    writeln(aa);
}

--
Apr 19 2020