www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7799] New: Can't use alias for overload resolution with alias this subtype

reply d-bugmail puremagic.com writes:
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



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
next sibling parent d-bugmail puremagic.com writes:
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



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
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7799





 Works in 2.063.2.
Note that, even `alias super.test test` is compiled, but still cannot call it from FooBar object. 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
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7799




03:58:24 PDT ---


 Works in 2.063.2.
Note that, even `alias super.test test` is compiled, but still cannot call it from FooBar object.
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: -------
Sep 19 2013