[Issue 9235] Template mixin doesn't allow to mixin non-conflicting overloads

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 30 05:50:01 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9235


Maksim Zholudev <maximzms at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maximzms at gmail.com


--- Comment #2 from Maksim Zholudev <maximzms at gmail.com> 2013-01-30 05:49:59 PST ---
http://dlang.org/template-mixin.html
"Alias declarations can be used to overload together functions declared in
different mixins"

Unfortunately this doesn't work:
-------------------
mixin template mixA()
{
    void foo(string s)() if(s == "a") {}
}

mixin template mixB()
{
    void foo(string s)() if(s == "b") {}
}

struct Foo
{
    mixin mixA A;
    mixin mixB B;
    alias A.foo foo;
    alias B.foo foo;
}

void main()
{
    Foo f;
    f.foo!"a"();
}
-------------------
test.d(16): Error: alias test.Foo.foo conflicts with alias test.Foo.foo at
test.d(15)
-------------------

It looks like signature constraints are ignored in this case.

-- 
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