Bug 6653 – [CTFE] internal error assigning struct

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-09-12T12:28:00Z
Last change time
2011-09-29T01:21:18Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-09-12T12:28:53Z
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 by clugdbug — 2011-09-29T01:21:18Z
*** This issue has been marked as a duplicate of issue 6419 ***