diff options
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/anonymous-struct-union-c11.c | 19 | ||||
-rw-r--r-- | clang/test/Sema/array-init.c | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/clang/test/Sema/anonymous-struct-union-c11.c b/clang/test/Sema/anonymous-struct-union-c11.c new file mode 100644 index 00000000000..229ee520575 --- /dev/null +++ b/clang/test/Sema/anonymous-struct-union-c11.c @@ -0,0 +1,19 @@ +// Check for warnings in non-C11 mode: +// RUN: %clang_cc1 -fsyntax-only -verify -Wc11-extensions %s + +// Expect no warnings in C11 mode: +// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -std=c11 %s + +struct s { + int a; + struct { // expected-warning{{anonymous structs are a C11 extension}} + int b; + }; +}; + +struct t { + int a; + union { // expected-warning{{anonymous unions are a C11 extension}} + int b; + }; +}; diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c index bd1dfd2c06f..a979fb9e57c 100644 --- a/clang/test/Sema/array-init.c +++ b/clang/test/Sema/array-init.c @@ -245,7 +245,7 @@ static void sppp_ipv6cp_up(); const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct is a GNU extension}} \ // expected-warning{{excess elements in struct initializer}} -struct _Matrix { union { float m[4][4]; }; }; //expected-warning{{anonymous unions are a GNU extension in C}} +struct _Matrix { union { float m[4][4]; }; }; //expected-warning{{anonymous unions are a C11 extension}} typedef struct _Matrix Matrix; void test_matrix() { const Matrix mat1 = { |