January 18, 2024 [Issue 24344] New: The getUDAs and stringof generate different result with different compiler | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24344 Issue ID: 24344 Summary: The getUDAs and stringof generate different result with different compiler Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: bitworld@qq.com 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. -- |
Copyright © 1999-2021 by the D Language Foundation