diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Sema/const-eval.c | 2 | ||||
-rw-r--r-- | test/Sema/i-c-e.c | 2 | ||||
-rw-r--r-- | test/Sema/struct-decl.c | 2 | ||||
-rw-r--r-- | test/Sema/typedef-variable-type.c | 2 | ||||
-rw-r--r-- | test/Sema/vla.c | 4 | ||||
-rw-r--r-- | test/SemaCXX/c99-variable-length-array.cpp | 9 |
6 files changed, 15 insertions, 6 deletions
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index 56c429c58c..bdb40ae54b 100644 --- a/test/Sema/const-eval.c +++ b/test/Sema/const-eval.c @@ -36,7 +36,7 @@ int g17[(3?:1) - 2]; EVAL_EXPR(18, ((int)((void*)10 + 10)) == 20 ? 1 : -1); struct s { - int a[(int)-1.0f]; // expected-error {{array size is negative}} + int a[(int)-1.0f]; // expected-error {{'a' declared as an array with a negative size}} }; EVAL_EXPR(19, ((int)&*(char*)10 == 10 ? 1 : -1)); diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c index 4d7007cd07..1aac51e204 100644 --- a/test/Sema/i-c-e.c +++ b/test/Sema/i-c-e.c @@ -1,4 +1,4 @@ -// RUN: %clang %s -ffreestanding -fsyntax-only -Xclang -verify -pedantic -fpascal-strings +// RUN: %clang %s -ffreestanding -fsyntax-only -Xclang -verify -pedantic -fpascal-strings -std=c99 #include <stdint.h> #include <limits.h> diff --git a/test/Sema/struct-decl.c b/test/Sema/struct-decl.c index e1c7073e01..6070e875f5 100644 --- a/test/Sema/struct-decl.c +++ b/test/Sema/struct-decl.c @@ -6,7 +6,7 @@ struct bar { struct foo { char name[(int)&((struct bar *)0)->n]; - char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{array size is negative}} + char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{'name2' declared as an array with a negative size}} }; // PR3430 diff --git a/test/Sema/typedef-variable-type.c b/test/Sema/typedef-variable-type.c index b805b1e057..8a7ee8b911 100644 --- a/test/Sema/typedef-variable-type.c +++ b/test/Sema/typedef-variable-type.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic -Wno-typedef-redefinition +// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic -Wno-typedef-redefinition -std=c99 // Make sure we accept a single typedef typedef int (*a)[!.0]; // expected-warning{{size of static array must be an integer constant expression}} diff --git a/test/Sema/vla.c b/test/Sema/vla.c index ebf9b889ee..fd7a6bf3d7 100644 --- a/test/Sema/vla.c +++ b/test/Sema/vla.c @@ -42,7 +42,7 @@ void f3() } // PR3663 -static const unsigned array[((2 * (int)((((4) / 2) + 1.0/3.0) * (4) - 1e-8)) + 1)]; // expected-warning {{size of static array must be an integer constant expression}} +static const unsigned array[((2 * (int)((((4) / 2) + 1.0/3.0) * (4) - 1e-8)) + 1)]; // expected-warning {{variable length array folded to constant array as an extension}} int a[*]; // expected-error {{star modifier used outside of function prototype}} int f4(int a[*][*]); @@ -53,7 +53,7 @@ int pr2044b; int (*pr2044c(void))[pr2044b]; // expected-error {{variably modified type}} const int f5_ci = 1; -void f5() { char a[][f5_ci] = {""}; } // expected-error {{variable-sized object may not be initialized}} +void f5() { char a[][f5_ci] = {""}; } // expected-warning {{variable length array folded to constant array as an extension}} // PR5185 void pr5185(int a[*]); diff --git a/test/SemaCXX/c99-variable-length-array.cpp b/test/SemaCXX/c99-variable-length-array.cpp index 98df1dbfe8..3f1d6a8a55 100644 --- a/test/SemaCXX/c99-variable-length-array.cpp +++ b/test/SemaCXX/c99-variable-length-array.cpp @@ -121,3 +121,12 @@ namespace PR8209 { (void)new vla_type; // expected-error{{variably}} } } + +namespace rdar8733881 { // rdar://8733881 + +static const int k_cVal3 = (int)(1000*0.2f); + int f() { + // Ok, fold to a constant size array as an extension. + char rgch[k_cVal3] = {0}; + } +} |