[Issue 20761] New: __traits(isSame) for alias tuples is broken and underspecified

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 23 07:04:34 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20761

          Issue ID: 20761
           Summary: __traits(isSame) for alias tuples is broken and
                    underspecified
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at 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)).

--


More information about the Digitalmars-d-bugs mailing list