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 :(
Comment #3 by slavo5150 — 2017-11-10T15:00:08Z
Comment #4 by github-bugzilla — 2017-11-11T09:35:43Z
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 <[email protected]>
Comment #5 by github-bugzilla — 2017-11-30T09:06:55Z
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