Bug 6751 – [CTFE] ref argument of AA doesn't work

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-10-01T09:00:00Z
Last change time
2011-10-04T16:39:25Z
Assigned to
nobody
Creator
youxkei

Comments

Comment #0 by youxkei — 2011-10-01T09:00:53Z
void f(ref int i, ref string str, ref int[int] aa){ i = 2; str ~= "hello"; aa[1] = 2; assert(aa[1] == 2); } static assert({ int[int] aa; int i; string str; f(i, str, aa); assert(i == 2);// OK assert(str == "hello");// OK assert(aa[1] == 2);// Error: cannot index null array aa }()); The above code doesn't be compiled by the dmd v2.056 DEBUG built from github after the commit 42fea4c1f2. This means that ref argument of AA doesn't work well in CTFE.
Comment #1 by clugdbug — 2011-10-02T13:29:35Z
This bug only applies in the case where the AA is null, at the moment when it is passed by reference.
Comment #2 by bugzilla — 2011-10-04T16:39:25Z