www.digitalmars.com         C & C++   DMDScript  

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

https://issues.dlang.org/show_bug.cgi?id=21432

          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
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.

--
Nov 27 2020