[Issue 5973] New: alias this is not considered with superclass lookup
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon May 9 21:22:18 PDT 2011
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 at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at 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: -------
More information about the Digitalmars-d-bugs
mailing list