digitalmars.D.bugs - [Issue 5973] New: alias this is not considered with superclass lookup
- d-bugmail puremagic.com (39/39) May 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5973
- d-bugmail puremagic.com (8/8) May 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5973
http://d.puremagic.com/issues/show_bug.cgi?id=5973 Summary: alias this is not considered with superclass lookup Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: k.hara.pg gmail.com --- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2011-05-09 21:18:21 PDT --- Following should compile, but not. (In comment, -> is superclass lookup, => is alias this lookup) ---- class A{ int a = 1; } class B{ int b = 2; } class C:A{ B obj; alias obj this; this(){ obj = new B(); } } class X:C{ } void main() { auto c = new C(); assert(c.a == 1); // lookup C -> A, OK assert(c.b == 2); // lookup C => B, OK auto x = new X(); assert(x.a == 1); // lookup X -> C -> A, OK assert(x.b == 2); // lookup X -> C => B, NG (Line 17) } ---- test.d(17): Error: no property 'b' for type 'test.X' ---- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5973 --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-05-09 21:35:29 PDT --- Patch considering only alias this is here: (It doesn't support opDot and opDispatch) https://github.com/9rnsr/dmd/tree/MultiInheritPatch -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2011