www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22362] New: ImportC: error parsing compound literal with more


          Issue ID: 22362
           Summary: ImportC: error parsing compound literal with more than
                    one value at function scope.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

// compound.c
typedef struct Foo {
    int x, y;
} Foo;

Foo gfoo = (Foo){0, 1}; // no error
int main(int argc, char** argv){
    Foo foo1 = (Foo){0}; // no error
    Foo foo2 = (Foo){0, 1}; // error here

compound.c(9): Error: found `=` when expecting `;` or `=`, did you mean `Foo
foo2 = (`?
compound.c(9): Error: found `=` instead of statement
compound.c(9): Error: identifier or `(` expected
compound.c(10): Error: identifier or `(` expected

Oct 06 2021