Bug 24344 – The getUDAs and stringof generate different result with different compiler

Status
NEW
Severity
critical
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-01-18T02:26:55Z
Last change time
2024-12-01T16:42:14Z
Assigned to
No Owner
Creator
Heromyth
Moved to GitHub: phobos#10542 →

Comments

Comment #0 by bitworld — 2024-01-18T02:26:55Z
Here is the test code ```d import std.stdio; import std.traits; void main() { const s1 = getUDAs!(__traits(getMember, User, "age"), Max)[0].stringof; const s2 = (getUDAs!(__traits(getMember, User, "age"), Max)[0]).stringof; writefln("s1=%s", s1); writefln("s2=%s", s2); } class User { @Max() // @Max int age; } struct Max { long value; string message = "must be less than or equal to {{value}}"; } ``` The output from DMD 2.106.1 is ```txt s1=Max(0L, "must be less than or equal to {{value}}") s2=arg ``` The output from DMD 2.095.1 is ```txt s1=Max(0L, "must be less than or equal to {{value}}") s2=Max(0L, "must be less than or equal to {{value}}") ``` The problem is that the s2 for DMD 2.106.1 got a wrong result.
Comment #1 by robert.schadek — 2024-12-01T16:42:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10542 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB