[Issue 12528] New: foreach with inout ref argument cannot be interpreted at compile time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 6 08:33:42 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12528
Summary: foreach with inout ref argument cannot be interpreted
at compile time
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: CTFE
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: code at dawg.eu
--- Comment #0 from Martin Nowak <code at dawg.eu> 2014-04-06 08:33:39 PDT ---
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.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list