www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - =?UTF-8?B?W0lzc3VlIDIyMzIxXSBOZXc6IEltcG9ydEM6IG5vbi1zdGF0aWMg?=


          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 puremagic.com
          Reporter: dave287091 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];

Sep 19 2021