Bug 21585 – add __traits(totype, string) to convert mangled type string to an existing type

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-01-26T08:45:05Z
Last change time
2021-04-02T05:45:29Z
Keywords
pull
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2021-01-26T08:45:05Z
Add totype as a __trait: --- __trait ( totype, AssignExpression ) --- AssignExpression is evaluated at compile time, and the result must be a string. The string must be a sequence of characters representing the mangling of an existing type. The __trait then represents that type. For example: --- pragma(msg, 1.mangleof); // prints `i` __traits(totype, "i") x; // declares `x` as having type `int` __traits(totype, "Pi") p; // declares `p` as having type `int*` __traits(totype, 3) y; // error: `3` is not a string __traits(totype, "#Hello") z; // error: `#Hello` is not a recognized mangling of a type --- Earlier work: https://github.com/dlang/dmd/pull/11797
Comment #1 by dlang-bot — 2021-01-26T10:00:31Z
@WalterBright created dlang/dmd pull request #12156 "fix Issue 21585 - add __traits(totype, string) to convert mangled typ…" fixing this issue: - fix Issue 21585 - add __traits(totype, string) to convert mangled type string to an existing type https://github.com/dlang/dmd/pull/12156
Comment #2 by dlang-bot — 2021-03-14T06:56:48Z
@WalterBright created dlang/dlang.org pull request #2981 "fix Issue 21585 - add __traits(totype, string)" fixing this issue: - fix Issue 21585 - add __traits(totype, string) https://github.com/dlang/dlang.org/pull/2981
Comment #3 by dlang-bot — 2021-03-15T21:37:02Z
dlang/dmd pull request #12156 "fix Issue 21585 - add __traits(totype, string) to convert mangled typ…" was merged into master: - 9d605db73a614541c4d622c879d9853d8b547d2a by Walter Bright: fix Issue 21585 - add __traits(totype, string) to convert mangled type string to an existing type https://github.com/dlang/dmd/pull/12156
Comment #4 by dlang-bot — 2021-03-16T01:26:59Z
dlang/dlang.org pull request #2981 "fix Issue 21585 - add __traits(totype, string)" was merged into master: - f8130348f00779ac97773608f6bbf53cfba893a1 by Walter Bright: fix Issue 21585 - add __traits(totype, string) https://github.com/dlang/dlang.org/pull/2981
Comment #5 by dlang-bot — 2021-04-02T05:45:29Z
dlang/dmd pull request #12339 "[dmd-cxx] Backport fixes and trivial features from upstream dmd" was merged into dmd-cxx: - 94a716fb10dfb00c513e00dca55bcdf74083e8fd by Walter Bright: [dmd-cxx] fix Issue 21585 - add __traits(totype, string) to convert mangled type string to an existing type https://github.com/dlang/dmd/pull/12339