Summary: Char array is turned into string expression during
                    constant folding
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-10-15 20:35:22 PDT ---
struct DChars
    dchar foo()
        return ary[0];

    dchar[] ary;

DChars get()
    DChars s;
    s.ary ~= 'H';
    s.ary ~= 'e';
    return s;

enum dchars = get().foo();

Which will bark:
Error: cannot cast a read-only string literal to mutable in CTFE

Cat in constfold.c turns null ~ char into a string expression
even though the type of null is not a string but a char array.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to