[Issue 22269] New: __traits(isSame) does not work for values passed to template alias parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 3 09:33:06 UTC 2021


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

          Issue ID: 22269
           Summary: __traits(isSame) does not work for values passed to
                    template alias parameters
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

## test case:

```
static assert(__traits(isSame, 0, 0));  // OK
enum isSame(alias a, alias b) = __traits(isSame, a, b);
static assert(isSame!(0,0));            // NG   
```

## notes:

1. the 2nd static assertion fails, which is surprising.
it does not if isSame signature is changed, e.g changing the template
parameters to value parameters or a variadic parameter.

2. it was made observation on the forum[1] that this leads to std.traits.isSame
to be more complex than it should.

[1]: https://forum.dlang.org/post/lsckaoejcmfnifcbsqjf@forum.dlang.org

--


More information about the Digitalmars-d-bugs mailing list