www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7560] New: Expanding inherited overload sets gives error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7560

           Summary: Expanding inherited overload sets gives error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: blm768 gmail.com



I've been working on a project that involves overloading and inheritance and
I've run into a bit of a problem. My code looks something like this:

class Base {
    void get(ubyte b);
}

class Derived: Base {
    alias Base.get get;
    void get(string s);
}

When I try to compile it, DMD says that the alias Derived.get conflicts with
Derived.get(string). This behavior makes sense to a degree (declaring
get(string) is creating a new overload instead of overriding an old one), but
it's probably not what anyone wants. It should be a fairly simple fix; just a
little special-case code in DMD for this type of alias or something...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 21 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7560




For some reason, it appears that my test case actually does compile :)
I guess I'd better check my test cases next time.
The original code is still broken, though; I'll try to put together a test case
that actually breaks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 22 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7560




I found a test case that should work:

class Base {
    template getter(T) {
        void get(ref T[] i, uint n) {}
    }
    mixin getter!uint;
    mixin getter!char;
}

class Derived: Base {
    alias Base.get get;
    void get(ref char[] x) {}
}

It appears to be a problem with trying to create new overloads when the base
class overloads are put there by multiple mixins. Using only one mixin seems to
work fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 22 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7560


blm768 gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Base class overloaded       |Base class overloaded
                   |methods created by mixins   |methods created by mixins
                   |can't be overrided          |can't be overriden



The original description is inaccurate; the second comment provides the correct
information and test case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 30 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7560


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/916

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 30 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7560




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7cea8d2bef94d2e7394c4ef96792acd782f73173
fix Issue 7560 - Base class overloaded methods created by mixins can't be
overriden

https://github.com/D-Programming-Language/dmd/commit/3e1358125feb935445370000ec883dc4afc3befc


Issue 7560 - Base class overloaded methods created by mixins can't be overriden

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 30 2012