[Issue 5896] const overload matching is succumb to template parameter one

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 23 17:44:58 PDT 2012


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



--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> 2012-04-23 17:45:58 PDT ---
More complicated test from my pull is still broken.

----
struct X5896
{
                 T opCast(T)(){ return 1; }    // L3
           const T opCast(T)(){ return 2; }    // L4
       immutable T opCast(T)(){ return 3; }
          shared T opCast(T)(){ return 4; }    // L6
    const shared T opCast(T)(){ return 5; }    // L7
}
void test5896()
{
    auto xm =              X5896  ();
    auto xc =        const(X5896) ();
    auto xi =    immutable(X5896) ();
    auto xs =       shared(X5896) ();
    auto xcs= const(shared(X5896))();
    assert(cast(int)xm == 1);    // L16
    assert(cast(int)xc == 2);
    assert(cast(int)xi == 3);    // L18
    assert(cast(int)xs == 4);    // L19
    assert(cast(int)xcs== 5);
}

Errors:
----
test.d(16): Error: template test.X5896.opCast matches more than one template
declaration, test.d(3):opCast(T) and test.d(4):opCast(T)
test.d(18): Error: template test.X5896.opCast matches more than one template
declaration, test.d(4):opCast(T) and test.d(7):opCast(T)
test.d(19): Error: template test.X5896.opCast matches more than one template
declaration, test.d(6):opCast(T) and test.d(7):opCast(T)

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