diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Preprocessor/line-directive.c | 4 | ||||
| -rw-r--r-- | clang/test/Sema/c11-typedef-redef.c | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/clang/test/Preprocessor/line-directive.c b/clang/test/Preprocessor/line-directive.c index 878d067a30d..102469449e1 100644 --- a/clang/test/Preprocessor/line-directive.c +++ b/clang/test/Preprocessor/line-directive.c @@ -41,7 +41,7 @@ # 192 "glomp.h" // not a system header. typedef int x; // expected-note {{previous definition is here}} -typedef int x; // expected-error {{redefinition of typedef 'x' is invalid in C}} +typedef int x; // expected-warning {{redefinition of typedef 'x' is a C11 feature}} # 192 "glomp.h" 3 // System header. typedef int y; // ok @@ -62,7 +62,7 @@ typedef int z1; // ok # 42 "blonk.h" // DOES change system headerness. typedef int w; // expected-note {{previous definition is here}} -typedef int w; // expected-error {{redefinition of typedef 'w' is invalid in C}} +typedef int w; // expected-warning {{redefinition of typedef 'w' is a C11 feature}} typedef int q; // original definition in system header, should not diagnose. diff --git a/clang/test/Sema/c11-typedef-redef.c b/clang/test/Sema/c11-typedef-redef.c new file mode 100644 index 00000000000..7e213f49cfc --- /dev/null +++ b/clang/test/Sema/c11-typedef-redef.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c11 %s -verify + +typedef int type; +typedef type type; +typedef int type; + +void f(int N) { + typedef int type2; + typedef type type2; + typedef int type2; + + typedef int vla[N]; // expected-note{{previous definition is here}} + typedef int vla[N]; // expected-error{{typedef redefinition with different types ('int [N]' vs 'int [N]')}} +} |

