[Issue 22321] New: ImportC: non-static arrays can’t be initialized by an initializer list.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 19 16:08:46 UTC 2021


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

          Issue ID: 22321
           Summary: ImportC: non-static arrays can’t be initialized by an
                    initializer list.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com

Demonstration of the problem:

int gnumbers[4] = {1,2,3,4}; // ok
int example(void){
    int numbers[4] = {1, 2, 3, 4}; // Error: variable `test.example.numbers` is
not a static and cannot have static initializer
    return numbers[1];
}

--


More information about the Digitalmars-d-bugs mailing list