aboutsummaryrefslogtreecommitdiff
path: root/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
commit73076431605556fdbf28d287d084a73a24a8b8d4 (patch)
treea3f64984f2c867b5ce2829cc31e50d3cf0563186 /test/Sema/array-init.c
parentc634f50c5cc892b899659c1743d696766c82afcd (diff)
The value of a const weak variable is not an integer constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/array-init.c')
-rw-r--r--test/Sema/array-init.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index a8ee3ca8df..bd1dfd2c06 100644
--- a/test/Sema/array-init.c
+++ b/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}}
+}