www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12520] New: Comparing two TypeTuples with == does not compile for no arguments

https://d.puremagic.com/issues/show_bug.cgi?id=12520

           Summary: Comparing two TypeTuples with == does not compile for
                    no arguments
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras gmail.com> 2014-04-04 06:37:40
PDT ---
assert(TypeTuple!1 == TypeTuple!1);
    assert(TypeTuple!("foo", 12.6) == TypeTuple!("foo", 12.6));

These lines compile. This line does not:

    assert(TypeTuple!() == TypeTuple());

The error message is:

    Error: incompatible types for ((()) == (())): cannot use '==' with types

In the case of generic code, this is problematic - if I have a type that can
take a variable number of arguments that are all required to be values, not
types, I have to special case comparison of empty args, or resort to weird
tricks like using a templated wrapper struct and comparing the types of two
wrappers:

    struct CMP(T...){}

    assert(is(CMP!args1 == CMP!args2));

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