www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20762] New: __traits(isSame) is underspecified for enums and


          Issue ID: 20762
           Summary: __traits(isSame) is underspecified for enums and
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Keywords: spec
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com


"2. If the two arguments are expressions made up of literals or enums that
evaluate to the same value, true is returned."

enum x = 1;
// this fails because x is treated as symbol
static assert(__traits(isSame, x, 1));

// this passes because now x is an expression
static assert(__traits(isSame, (x), 1));

The spec should be clear about this.

Apr 23 2020