www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23217] New: ImportC: extra initializer(s) error for array of

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

          Issue ID: 23217
           Summary: ImportC: extra initializer(s) error for array of
                    structs
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following:

  typedef struct {
   int a,b,c;
  } code;
  const code array[2] = { {96,7,0}, {0,8,80} };
  const code distfix[2] = { {22,5,193}, {64,5,0} };

fails for distfix with:

  test.c(8): Error: 2 extra initializer(s) for `struct __tag3`
  test.c(8): Error: 2 extra initializer(s) for `struct __tag3`

It's related to the typedef and the const somehow.

--
Jun 29 2022