[Issue 3537] New: Casting objects with alias this takes the subtype
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 21 08:27:38 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3537
Summary: Casting objects with alias this takes the subtype
Product: D
Version: 2.036
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: tomeksowi at gmail.com
--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2009-11-21 08:27:36 PST ---
interface I { }
class A : I {
int x;
alias x this;
void f() {
auto i = cast(I) this; // ouch
}
}
Should work but doesn't:
Error: e2ir: cannot cast this.x of type int to type hello.I
The cast can be outside -- still the same error:
void main() {
auto a = new A;
auto i = cast(I) a; // ouch
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list