August 29, 2014 [Issue 13392] New: class + alias this + cast(void*) == overzealous cast | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13392 Issue ID: 13392 Summary: class + alias this + cast(void*) == overzealous cast Product: D Version: D2 Hardware: All OS: Linux Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: monarchdodra@gmail.com Given a class with alias this that produces another class, then "cast(void*)" will call the alias this, and try to do a cast on the alias this'ed class. I think this is wrong, since, by definition, both classes are equally good candidates for the cast, so the alias this should not happen. //---- void foo(T)(T t) { void* p = cast(void*) t; //Callas alias this } class A { } class B { alias a this; @property A a(){assert(0);} //Here } void main() { foo(B.init); } //---- --- killed by signal 11 //---- -- |
Copyright © 1999-2021 by the D Language Foundation