December 15, 2020 [Issue 21482] New: dynamic indexing into enum dynamic array at ctfe generates TypeInfo in betterC | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21482 Issue ID: 21482 Summary: dynamic indexing into enum dynamic array at ctfe generates TypeInfo in betterC Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: dave287091@gmail.com Compiling with DMD, with -betterC DMD64 D Compiler v2.094.2-336-g97aa2ae5e // works int f_1(int a){ enum int[]foo = [1,2,3]; if(__ctfe) return foo[1]; return 1; } // works int f_2(int a){ static immutable int[] foo = [1,2,3]; if(__ctfe) return foo[a]; return 2; } // fails with TypeInfo cannot be used with -betterC int f_3(int a){ enum int[]foo = [1,2,3]; if(__ctfe) return foo[a]; // Error is reported at this line. return 3; } All three work with ldc. -- |
Copyright © 1999-2021 by the D Language Foundation