Bug 19029 – Provide alias symbol name trait

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-26T14:13:35Z
Last change time
2024-12-13T18:59:20Z
Assigned to
No Owner
Creator
Radu Racariu
Moved to GitHub: dmd#17867 →

Comments

Comment #0 by radu.racariu — 2018-06-26T14:13:35Z
Currently there is no way to get the name of the alias for a symbol type. For example the following: === void main() { import std.traits; size_t s; pragma(msg, typeof(s).stringof); pragma(msg, mangledName!(typeof(s))); pragma(msg, mangledName!s); } === Prints --- ulong m _D9onlineapp4mainFZ1sm --- For code generation porpoises (eg. generate C wrapper code) there is no way to get the type of `s` as `size_t` because `size_t` is an alias. A new trait, `__traits(aliasName, symbol)`, could be used to retrieve the alias name for a symbol type. This trait will return the name of the concrete type if the symbol type is not an alias.
Comment #1 by robert.schadek — 2024-12-13T18:59:20Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17867 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB