6765 – [CTFE]: AA.length doesn't compile when AA is null

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6765 - [CTFE]: AA.length doesn't compile when AA is null
Summary: [CTFE]: AA.length doesn't compile when AA is null
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2011年10月04日 05:53 UTC by Don
Modified: 2015年06月09日 05:10 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2011年10月04日 05:53:43 UTC
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.


AltStyle によって変換されたページ (->オリジナル) /