www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13944] New: Built-in stringof and mangleof properties are


          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 puremagic.com
          Reporter: k.hara.pg 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.

Jan 06 2015