D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4022 - [CTFE] AA get
Summary: [CTFE] AA get
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2010-03-28 06:40 UTC by bearophile_hugs
Modified: 2011-10-06 23:30 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-03-28 06:40:18 UTC
This program, compiled with dmd 2.042:


int foo() {
    int[int] aa = [1: 1];
    int r = aa.get(1, 1000);
    return 1;
}
enum _ = foo();
void main() {}



Generates the errors:

...\dmd\src\druntime\import\object.di(366): Error: Cannot interpret key in *cast(int[int]*)&this.p at compile time
test.d(5): Error: cannot evaluate aa.get(1,delegate int()

{

return 1000;

}

) at compile time
test.d(8): Error: cannot evaluate foo() at compile time
test.d(8): Error: cannot evaluate foo() at compile time
Comment 1 Don 2011-10-06 03:54:59 UTC
This is D2-only.