aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/anonymous-struct-union-c11.c
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-02-03 15:47:04 +0000
committerHans Wennborg <hans@hanshq.net>2012-02-03 15:47:04 +0000
commitacbabf177079ed41c055b1484465082f9f1d3d06 (patch)
tree4034b17c92b7e4b5344412e7dc8ce12557b07003 /test/Sema/anonymous-struct-union-c11.c
parent8fbbae532e3cb5f45e9e862c60d48c78b0997325 (diff)
Don't warn about anonymous struct/union in C11.
Also, in C, call this a C11 extension rather than a GNU extension. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/anonymous-struct-union-c11.c')
-rw-r--r--test/Sema/anonymous-struct-union-c11.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Sema/anonymous-struct-union-c11.c b/test/Sema/anonymous-struct-union-c11.c
new file mode 100644
index 0000000000..229ee52057
--- /dev/null
+++ b/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;
+ };
+};