[Issue 20032] New: ImmutableOf!char[] The result is incorrect.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 7 03:57:47 UTC 2019


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 at puremagic.com
          Reporter: shove at 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!

--


More information about the Digitalmars-d-bugs mailing list