www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21961] New: importC: Error: no struct-declarator-list for

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

          Issue ID: 21961
           Summary: importC: Error: no struct-declarator-list for struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Empty structs are accepted as valid C, even though the behaviour is undefined.
---
struct agg
{
};
---

C99 6.7.2.1-8:
The presence of a struct-declaration-list in a struct-or-union-specifier
declares a new type, within a translation unit. The struct-declaration-list is
a sequence of declarations for the members of the structure or union. If the
struct-declaration-list does not contain any named members, either directly or
via an anonymous structure or anonymous union, the behavior is undefined. The
type is  incomplete until immediately after the } that terminates the list, and
complete thereafter.

--
May 24