Bug 8659 – CTFE: str ~= wchar rejected if string was initialized with an array literal

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-09-14T03:39:55Z
Last change time
2024-12-13T18:01:22Z
Keywords
CTFE, rejects-valid
Assigned to
No Owner
Creator
Don
Depends on
8660
Moved to GitHub: dmd#18469 →

Comments

Comment #0 by clugdbug — 2012-09-14T03:39:55Z
This was the second bug reported in bug 8601. It's completely unrelated to the first one. A string initialized with an array literal doesn't support ~= of a character of a larger size. bool bug() { string r = ['x', 'q']; dchar c = 'ü'; r ~= c; assert(r == "xqü"); return true; } static assert(bug()); bug.d(8): Error: Cannot interpret r ~= c at compile time I'm not entirely sure what to do with this. The problem is, after r~=c, is r a string literal or an array literal?
Comment #1 by clugdbug — 2012-09-17T01:03:35Z
The spec-related issue of the difference between string literals and array literals is in bug 8660.
Comment #2 by robert.schadek — 2024-12-13T18:01:22Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18469 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB