Bug 21251 – parameter UDA type not equal to itself

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-16T01:40:42Z
Last change time
2024-12-13T19:11:32Z
Assigned to
No Owner
Creator
elpenguino+D
Moved to GitHub: dmd#19787 →

Comments

Comment #0 by elpenguino+D — 2020-09-16T01:40:42Z
``` enum A; static if (is(typeof(& func) Fsym : Fsym*)) { static if (is(Fsym P == function)) { static assert(is(A == A)); //okay static assert(is(__traits(getAttributes, P[0 .. 1])[0] == A)); //wait, what? A != A? } } void func(@A int) {} ``` The static asserts in this code should both pass. Interestingly, DMD 2.084 - 2.091 seem to crash instead of producing any errors.
Comment #1 by simen.kjaras — 2020-09-16T06:24:00Z
Also, this works: alias T = __traits(getAttributes, P[0 .. 1])[0]; static assert(is(T == A));
Comment #2 by robert.schadek — 2024-12-13T19:11:32Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19787 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB