Bug 13944 – Built-in stringof and mangleof properties are unnecessarily fixed to the type 'string'
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-06T09:16:00Z
Last change time
2015-02-18T03:41:55Z
Keywords
pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2015-01-06T09:16:28Z
Example code:
struct S {}
string cs = S.stringof; // OK
wstring ws = S.stringof; // NG
dstring ds = S.stringof; // NG
The reason is that 'stringof' property makes a suffixed string literal "S"c rather than "S".
The literal type is enforced to 'string' by the suffix, so it cannot be converted to '[wd]string'.
The same issue exists on mangleof property.
string cm = S.mangleof; // OK
wstring wm = S.mangleof; // NG
dstring dm = S.mangleof; // NG
I think the restriction should be lifted.