www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20761] New: __traits(isSame) for alias tuples is broken and


          Issue ID: 20761
           Summary: __traits(isSame) for alias tuples is broken and
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

// fails
static assert(__traits(isSame, AliasSeq!(1, 2), AliasSeq!(1, 2)));

// passes
static assert(__traits(isSame, AliasSeq!(1, 1), AliasSeq!(1, 1)));

If the tuples are meant to expand, then both assertions should fail with a
"wrong number of arguments" error. Otherwise, both assertion should pass.

To me, the most consistent semantics would be for __traits(isSame) to behave as
a template with two alias parameters (it would be necessary to nest tuples in
another template before passing them to __traits(isSame)).

Apr 23 2020