[Issue 8522] New: Overloading template function with prefix const doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 8 08:17:32 PDT 2012


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

           Summary: Overloading template function with prefix const
                    doesn't work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-08-08 08:17:28 PDT ---
Postfix const works, but prefix version doesn't work

struct Tuple(Specs...)
{
    Specs field;

    bool opEquals(R)(R rhs) { return true; }

//  bool opEquals(R)(R rhs) const { return true; }  // OK
    const bool opEquals(R)(R rhs) { return true; }  // NG
}

void main()
{
    Tuple!(size_t, size_t) t;
    assert(t == t);    // line 14
}

output:
test.d(14): Error: template test.Tuple!(uint,uint).Tuple.opEquals matches more
than one template declaration, test.d(5):opEquals(R) and test.d(8):opEquals(R)

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