summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-init.c
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-01-05 00:13:19 +0000
committerJohn McCall <rjmccall@apple.com>2012-01-05 00:13:19 +0000
commita59dc2f8f0afedb980a301359e9e621f6e604853 (patch)
treee5bd1b225f0a66a7b996545613185e0f39f7749b /clang/test/Sema/array-init.c
parentfcc54a3b91c9b429e0384238fbe42f73fec757ca (diff)
downloadbcm5719-llvm-a59dc2f8f0afedb980a301359e9e621f6e604853.tar.gz
bcm5719-llvm-a59dc2f8f0afedb980a301359e9e621f6e604853.zip
The value of a const weak variable is not an integer constant.
llvm-svn: 147575
Diffstat (limited to 'clang/test/Sema/array-init.c')
-rw-r--r--clang/test/Sema/array-init.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c
index a8ee3ca8df1..bd1dfd2c06f 100644
--- a/clang/test/Sema/array-init.c
+++ b/clang/test/Sema/array-init.c
@@ -167,7 +167,7 @@ void charArrays() {
void variableArrayInit() {
int a = 4;
- char strlit[a] = "foo"; //expected-error{{array initializer must be an initializer list or string literal}}
+ char strlit[a] = "foo"; //expected-error{{variable-sized object may not be initialized}}
int b[a] = { 1, 2, 4 }; //expected-error{{variable-sized object may not be initialized}}
}
@@ -278,3 +278,10 @@ int a6[5] = (int[]){1, 2, 3}; // expected-error{{cannot initialize array of type
int nonconst_value();
int a7[5] = (int[5]){ 1, 2, 3, 4, nonconst_value() }; // expected-error{{initializer element is not a compile-time constant}}
+
+// <rdar://problem/10636946>
+__attribute__((weak)) const unsigned int test10_bound = 10;
+char test10_global[test10_bound]; // expected-error {{variable length array declaration not allowed at file scope}}
+void test10() {
+ char test10_local[test10_bound] = "help"; // expected-error {{variable-sized object may not be initialized}}
+}
OpenPOWER on IntegriCloud