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

           Summary: Const Tuple equality
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-03-24 16:55:26 PDT ---
Problem found on tuples by Magnus Lie Hetland, then reduced:


import std.typecons;
void main() {
    alias Tuple!int T;
    const T t;
    bool b = t == t;
}


DMD 2.052 shows:

test.d(5): Error: template std.typecons.Tuple!(int).Tuple.opEquals(R) if
(isTuple!(R)) does not match any function template declaration
test.d(5): Error: template std.typecons.Tuple!(int).Tuple.opEquals(R) if
(isTuple!(R)) cannot deduce template function from argument types
!()(const(Tuple!(int)))



I think it can be further reduced to:

struct Foo(T) {
    bool opEquals(R)(R rhs) {
        return false;
    }
}
void main() {
    const Foo!int f;
    bool result = f == f;
}

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

Reply via email to