Bug 22269 – __traits(isSame) does not work for values passed to template alias parameters

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-03T09:33:06Z
Last change time
2024-12-13T19:18:17Z
Assigned to
No Owner
Creator
basile-z
See also
https://issues.dlang.org/show_bug.cgi?id=20762
Moved to GitHub: dmd#18054 →

Comments

Comment #0 by b2.temp — 2021-09-03T09:33:06Z
## 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/[email protected]
Comment #1 by nick — 2023-02-22T15:30:21Z
Workaround - use __traits(isSame, (a), (b))
Comment #2 by robert.schadek — 2024-12-13T19:18:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18054 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB