[Issue 21432] New: [CTFE] Cannot declare enum array in function scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 27 12:30:48 UTC 2020


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 at puremagic.com
          Reporter: maxsamukha at 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.

--


More information about the Digitalmars-d-bugs mailing list