Authors: Jay Ghiron
Date: 2026-06-05
Submitted against: C23
Status: Open
Cross-references: 0212
Some compilers such as GCC support empty structure types:
struct S{};//GCC extension
Since the standard does not exhaustively define what complete object types are, it appears that implementation specific types can be considered complete object types. For example:
struct _mbstate{};//GCC extension
typedef struct _mbstate mbstate_t;
If this definition is used, then the following is not valid:
#include<wchar.h>
int main(){
mbstate_t s={0};
}
With GCC specifically since it makes the size zero perhaps it cannot be considered a complete object type due to:
Except for bit-fields, objects are composed of contiguous sequences of one or more bytes, the number, order, and encoding of which are either explicitly specified or implementation-defined.
(C23 6.2.6.1 "General" paragraph 2.)
But an implementation which adds at least one padding byte could
definitely consider this to be a complete object type. Were any
constraints on implementation specific types used in standard library
types intended? Note that DR 212 suggests {0} should
be a valid initializer for mbstate_t. Since implementation specific
types are outside of the scope of the standard, there does not appear
to be any specific requirements on their behavior.