- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15
 
Closed
Description
Expected
struct X_char {
  char i;
  char data[];
};
struct X_short {
  char i;
  short data[];
};
static_assert(sizeof(struct X_char) == 1);
static_assert(alignof(struct X_char) == 1);
static_assert(sizeof(struct X_short) == 2);
static_assert(alignof(struct X_short) == alignof(short));cxx -xc x.c  -fcheck
x.c:2:8: error: size of incomplete type 'char data[]'
struct X_char {
       ^
x.c:7:8: error: size of incomplete type 'short data[]'
struct X_short {
       ^
x.c:13:1: error: static assert failed
static_assert(sizeof(struct X_char) == 1);
^
x.c:16:1: error: static assert failed
static_assert(sizeof(struct X_short) == 2);
^
x.c:17:1: error: static assert failed
static_assert(alignof(struct X_short) == alignof(short));
^Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Done