[Issue 13392] New: class + alias this + cast(void*) == overzealous cast
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Aug 28 03:53:28 PDT 2014
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 at puremagic.com
Reporter: monarchdodra at 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
//----
--
More information about the Digitalmars-d-bugs
mailing list