This is a further reduction of issue 16182. Filing this as a separate issue, because issue 16182 is a phobos issue that can be fixed by working around the compiler bug here. ---- string f() { return ['f']; } string g(string s) { return s; } enum string x = f(); enum string y = x ~ '.' ~ g("g"); /* Error: cannot implicitly convert expression ("f.g") of type char[] to string */ ----
Works with 2.067.1 and earlier. Promoting to regression.
Further reduced: void main() { string g(string s) { return s; } enum string y = ['f'] ~ g("g"); } Can be worked around with: void main() { string g(string s) { return s; } enum string y = cast(string)['f'] ~ g("g"); } weird error :(
potential fix: https://github.com/dlang/dmd/pull/7298
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4ae9018f971c04923f1385c3b25f6cee3c1603f4 Fix Issue 16183 - [REG2.068] compile-time string concatenation fails with CTFE and char[] literal involved https://github.com/dlang/dmd/commit/12964b358fbe1b1c12fbfbae4a6d05109873a9a7 Merge pull request #7298 from JinShil/fix16183 Fix Issue 16183 - [REG2.068] compile-time string concatenation fails … merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4ae9018f971c04923f1385c3b25f6cee3c1603f4 Fix Issue 16183 - [REG2.068] compile-time string concatenation fails with CTFE and char[] literal involved https://github.com/dlang/dmd/commit/12964b358fbe1b1c12fbfbae4a6d05109873a9a7 Merge pull request #7298 from JinShil/fix16183