https://issues.dlang.org/show_bug.cgi?id=7492
Kenji Hara <k.hara...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=14017 Resolution|INVALID |--- --- Comment #7 from Kenji Hara <k.hara...@gmail.com> --- (In reply to Denis Shelomovskij from comment #5) > Filed issue 14017. By looking the code in 14017, I recognized the real issue at last... Full code to illustrate issue. int[] f() { return new int[](1); } char[] g() { return new char[](1); } immutable( int[]) a = f(); // [A] accepted immutable(char[]) s = g(); // [B] rejected If we just only consider type system, both conversions: int[] to immutable( int[]) char[] to immutable(char[]) are not possible. But if we also consider CTFE, we can regard that the function calls will be replaced with the literals that returned by CTFE: immutable( int[]) a = [0]; immutable(char[]) s = ['\xff']; and literals can be convertible to the variable type. --- By looking dmd internals, current semantic process is nearly the latter replacement model. And maybe the [B] case is happened by the issue in the interpreter code for scrubbing CTFE return value. But, at the same time the case [A] looks like a kind of type system breaking. Anyway, at least it's an inconsistent compiler behavior. I reopen this. --