Bug 16183 – [REG2.068] compile-time string concatenation fails with CTFE and char[] literal involved
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-06-18T21:16:50Z
Last change time
2017-11-30T09:06:55Z
Keywords
CTFE, rejects-valid
Assigned to
No Owner
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2016-06-18T21:16:50Z
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 */
----
Comment #1 by ag0aep6g — 2016-06-18T21:20:26Z
Works with 2.067.1 and earlier. Promoting to regression.
Comment #2 by slavo5150 — 2017-11-10T12:45:41Z
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 :(