digitalmars.D.bugs - [Issue 7799] New: Can't use alias for overload resolution with alias this subtype
- d-bugmail puremagic.com (37/37) Mar 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7799
- d-bugmail puremagic.com (11/11) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7799
- d-bugmail puremagic.com (20/21) Sep 19 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7799
- d-bugmail puremagic.com (9/14) Sep 19 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7799
http://d.puremagic.com/issues/show_bug.cgi?id=7799 Summary: Can't use alias for overload resolution with alias this subtype Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-03-30 05:57:38 PDT --- class Foo { bool test() { return true; } } class Bar { Foo foo; alias foo this; } class FooBar : Bar { bool test(int x) { return true; } alias super.test test; } void main() {} test.d(17): Error: 'this' is only defined in non-static member functions, not FooBar test.d(17): Error: alias test.FooBar.test cannot alias an expression (__error).foo.test The error message is quite weird as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7799 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME --- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-17 14:32:19 PDT --- Works in 2.063.2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7799 --- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-09-19 00:05:39 PDT --- (In reply to comment #1)Works in 2.063.2.Note that, even `alias super.test test` is compiled, but still cannot call it from FooBar object. // class definitions are same as comment#0 void main() { auto c = new FooBar(); assert(c.test()); // Error: this for test needs to be type Foo not type test.FooBar assert(c.test(1)); // OK } Currently D does not support expression alias, so `alias super.test test` would lost the implicit expression context 'foo' by alias this. Then, c.test() will be rewritten to `(c, Foo.test())`, and fails to compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 19 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7799 --- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-19 03:58:24 PDT --- (In reply to comment #2)(In reply to comment #1)Hmm, so the test-case was incomplete. Should I reopen the issue or mark it as a duplicate of that other bug about expression alias not being supported? (I can't remember the bug number at the moment). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------Works in 2.063.2.Note that, even `alias super.test test` is compiled, but still cannot call it from FooBar object.
Sep 19 2013