[Issue 24155] New: ImportC: empty braces not accepted as struct initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 24 01:39:36 UTC 2023


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

          Issue ID: 24155
           Summary: ImportC: empty braces not accepted as struct
                    initializer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com

Following fails to compile:

    struct S {
        int x;
    };
    struct S s = {}; // Error: expression expected, not `}`

Before C23, this was a common C extension to 0-initialize all fields (accepted
by GCC, clang, and maybe MSVC (not sure on that one)). C23 has also added it to
standard C.

--


More information about the Digitalmars-d-bugs mailing list