Bug 21432 – [CTFE] Cannot declare enum array in function scope

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-11-27T12:30:48Z
Last change time
2022-07-12T14:17:27Z
Keywords
CTFE, pull, rejects-valid
Assigned to
No Owner
Creator
Max Samukha

Comments

Comment #0 by maxsamukha — 2020-11-27T12:30:48Z
auto foo() { enum int[] a = []; return a; } enum a = foo; void main() { } onlineapp.d(4): Error: declaration (enum int[] a = [];) is not yet implemented in CTFE onlineapp.d(8): called from here: foo() Compiles if the declaration is moved out of the function or the array type is omitted.
Comment #1 by dlang-bot — 2022-07-12T13:15:20Z
@ibuclaw created dlang/dmd pull request #14296 "fix Issue 21104 - certain array operations fail during CTFE when used to initialize a static array" fixing this issue: - fix Issue 21432 - [CTFE] Cannot declare enum array in function scope https://github.com/dlang/dmd/pull/14296
Comment #2 by dlang-bot — 2022-07-12T14:17:27Z
dlang/dmd pull request #14296 "fix Issue 21104 - certain array operations fail during CTFE when used to initialize a static array" was merged into master: - e3525ec96a3b66ec420d2fc2bd7f40721fea2a34 by Iain Buclaw: fix Issue 21432 - [CTFE] Cannot declare enum array in function scope https://github.com/dlang/dmd/pull/14296