Bug 12528 – [CTFE] cannot append elements from one inout array to another inout array
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-06T08:33:00Z
Last change time
2014-04-07T03:18:31Z
Keywords
CTFE, pull, rejects-valid
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2014-04-06T08:33:39Z
cat > bug.d << CODE
inout(T)[] dup(T)(inout(T)[] a)
{
inout(T)[] res;
foreach (ref e; a)
res ~= e;
return res;
}
enum works = dup([0]);
enum trigger = dup([0, 1]);
CODE
dmd -c bug.d
----
bug.d(5): Error: Cannot interpret res ~= e at compile time
bug.d(10): called from here: dup([0, 1])
----
Probably some issue when reassigning the foreach argument because it's only triggered when the array has more than one element.