www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21432] New: [CTFE] Cannot declare enum array in function scope


          Issue ID: 21432
           Summary: [CTFE] Cannot declare enum array in function scope
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: CTFE, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

auto foo() {
    enum int[] a = [];
    return a;

enum a = foo;

void main() {

onlineapp.d(4): Error: declaration (enum int[] a = [];) is not yet implemented
onlineapp.d(8):        called from here: foo()

Compiles if the declaration is moved out of the function or the array type is

Nov 27 2020