https://issues.dlang.org/show_bug.cgi?id=7492
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Kenji Hara <[email protected]> --- (In reply to Denis Shelomovskij from comment #0) > --- > auto f() { return new char[1]; } > > immutable s = f(); // error, works with non-character arrays > --- > Error: cannot implicitly convert expression ("\xff") of type char[] to > immutable(char[]) The function returns char[]. In D type system, char[] to immutable(char[]) conversion is not allowed. If you annotate the function f with pure attribute, f() will return an unique array so compiler will allow the conversion. Anyway, this is not CTFE problem. The code is trying to violate D type system, and compiler reports the error correctly. --
