D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16183 - [REG2.068] compile-time string concatenation fails with CTFE and char[] literal involved
Summary: [REG2.068] compile-time string concatenation fails with CTFE and char[] liter...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: CTFE, rejects-valid
Depends on:
Blocks:
 
Reported: 2016-06-18 21:16 UTC by ag0aep6g
Modified: 2017-11-30 09:06 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ag0aep6g 2016-06-18 21:16:50 UTC
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 ag0aep6g 2016-06-18 21:20:26 UTC
Works with 2.067.1 and earlier. Promoting to regression.
Comment 2 Mike Franklin 2017-11-10 12:45:41 UTC
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 Mike Franklin 2017-11-10 15:00:08 UTC
potential fix: https://github.com/dlang/dmd/pull/7298
Comment 4 github-bugzilla 2017-11-11 09:35:43 UTC
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>
Comment 5 github-bugzilla 2017-11-30 09:06:55 UTC
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