6769 – [CTFE] AA.keys doesn't compile when -inline is used

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6769 - [CTFE] AA.keys doesn't compile when -inline is used
Summary: [CTFE] AA.keys doesn't compile when -inline is used
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月05日 01:39 UTC by Don
Modified: 2011年10月05日 20:39 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月05日 01:39:45 UTC
This is an extremely ugly issue which broke the autotester.
The problem is the templated AA inside object.di. It performs some nasty casts to void[], then calls the runtime. To avoid this, the CTFE engine intercepts all AA built-in functions at a higher level. But, the inliner really fouls things up, because it optimizes away the functions which the CTFE engine tries to recognize.
Minimal test case for 2.055
static assert({
 int[int] w= [1:2];
 return w.keys.length;
}()==1);
This works OK, as long as -inline isn't used. But with -inline, it gives:
c:\dmd\windows\bin\..\..\src\druntime\import\object.di(378): Error: _aaKeys cann
ot be interpreted at compile time, because it has no available source code
test.d(6): Error: cannot evaluate delegate @system uint()
{
int[int] w = [1:2];
return (ref AssociativeArray!(int,int) this = w;
 , (assert(&this,"null this") , (void[] a = _aaKeys(this.p,4u);
 , *& a))).length;
}
() at compile time
-------
Note that the member variable 'p' is void *. The whole thing is a disgusting cast-fest.


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