[Issue 13944] New: Built-in stringof and mangleof properties are unnecessarily fixed to the type 'string'

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 6 01:16:28 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13944

          Issue ID: 13944
           Summary: Built-in stringof and mangleof properties are
                    unnecessarily fixed to the type 'string'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: k.hara.pg at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list