D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6653 - [CTFE] internal error assigning struct
Summary: [CTFE] internal error assigning struct
Status: RESOLVED DUPLICATE of issue 6419
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: 2011-09-12 12:28 UTC by bearophile_hugs
Modified: 2011-09-29 01:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-09-12 12:28:53 UTC
Maybe this is an enhancement request. D2 code:


import std.algorithm;
int sqr(in int x) pure nothrow { return x * x; }
enum r = map!sqr([3, 6]);
void main() {}


DMD 2.055 gives:

...\src\phobos\std\algorithm.d(459): Error: CTFE internal error assigning struct
test.d(3): Error: cannot evaluate map([3,6]) at compile time

------------------

I don't know if an enum range is meaningful, my final purpose was to create a compile-time constant array:

enum int[] r = array(map!sqr([3, 6]));
Comment 1 Don 2011-09-29 01:21:18 UTC

*** This issue has been marked as a duplicate of issue 6419 ***