empty1.c revision 122e601886ae527d6e7100c589339c05190a168a
1// RUN: %clang_cc1 %s -fsyntax-only -verify -Wc++-compat
2
3struct emp_1 { // expected-warning {{empty struct has size 0 in C, size 1 in C++}}
4};
5
6union emp_2 { // expected-warning {{empty union has size 0 in C, size 1 in C++}}
7};
8
9struct emp_3 { // expected-warning {{struct with only bit-fields of width 0 has size 0 in C, size 1 in C++}}
10  int : 0;
11};
12
13union emp_4 { // expected-warning {{union with only bit-fields of width 0 has size 0 in C, size 1 in C++}}
14  int : 0;
15};
16
17struct emp_5 { // expected-warning {{struct with only bit-fields of width 0 has size 0 in C, size 1 in C++}}
18  int : 0;
19  int : 0;
20};
21
22union emp_6 { // expected-warning {{union with only bit-fields of width 0 has size 0 in C, size 1 in C++}}
23  int : 0;
24  int : 0;
25};
26