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