Bug 6765 – [CTFE]: AA.length doesn't compile when AA is null
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-10-04T05:53:00Z
Last change time
2015-06-09T05:10:40Z
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2011-10-04T05:53:43Z
At compile time, if an AA is null, then AA.length is zero.
int main()
{
int[int] w;
return w.length; // OK
}
But:
static assert({
int[int] w;
return w.length;
}()==0);
fails with:
\..\src\druntime\import\object.di(362): Error: _aaLen cannot be interpreted at compile time, because it has no available source code
Both D1 and D2.