[Issue 5783] New: Const Tuple equality

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 24 16:58:48 PDT 2011


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: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list