www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21510] New: __traits(isSame, a, AliasSeq!a) returns true if


          Issue ID: 21510
           Summary: __traits(isSame, a, AliasSeq!a) returns true if "a" is
                    a scalar
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

https://github.com/dlang/dmd/pull/11392 implies that the language designers
decided not to flatten template argument tuples (or whatever is he right name)
passed to __traits(isSame). The PR partially implements the decision but makes
no distinction between a singleton tuple and a scalar, which introduces an
undesirable inconsistency:

static assert(is(int == AliasSeq!int)); // false as expected
static assert(__traits(isSame, int, AliasSeq!int); // true, but false is

Dec 28 2020