www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20032] New: ImmutableOf!char[] The result is incorrect.

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

          Issue ID: 20032
           Summary: ImmutableOf!char[] The result is incorrect.
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: shove 163.com

When the template parameter is char:

    alias A = char[];
    alias ImmuTypeA = ImmutableOf!A;
    pragma(msg, ImmuTypeA);    // -> immutable(string), Should be:
immutable(char[])

    alias B = immutable (char) [];
    alias ImmuTypeB = ImmutableOf!B;
    pragma(msg, ImmuTypeB);    // -> immutable(string), OK!


This incorrect does not exist when the template parameter is int:

    alias A = int[];
    alias ImmuTypeA = ImmutableOf!A;
    pragma(msg, ImmuTypeA);    // -> immutable(int[]), OK!

    alias B = immutable (int) [];
    alias ImmuTypeB = ImmutableOf!B;
    pragma(msg, ImmuTypeB);    // -> immutable(int[]), OK!

--
Jul 06 2019