xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/anonymous-struct-union-c11.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // Check for warnings in non-C11 mode:
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c99 -verify -Wc11-extensions %s
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // Expect no warnings in C11 mode:
5*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c11 -pedantic -Werror %s
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc struct s {
8f4a2713aSLionel Sambuc   int a;
9f4a2713aSLionel Sambuc   struct { // expected-warning{{anonymous structs are a C11 extension}}
10f4a2713aSLionel Sambuc     int b;
11f4a2713aSLionel Sambuc   };
12f4a2713aSLionel Sambuc };
13f4a2713aSLionel Sambuc 
14f4a2713aSLionel Sambuc struct t {
15f4a2713aSLionel Sambuc   int a;
16f4a2713aSLionel Sambuc   union { // expected-warning{{anonymous unions are a C11 extension}}
17f4a2713aSLionel Sambuc     int b;
18f4a2713aSLionel Sambuc   };
19f4a2713aSLionel Sambuc };
20