Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60638 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/vla.c b/test/Sema/vla.c
index 682d2fb..bccd5e6 100644
--- a/test/Sema/vla.c
+++ b/test/Sema/vla.c
@@ -16,3 +16,28 @@
// PR3048
int x = sizeof(struct{char qq[x];}); // expected-error {{fields must have a constant size}}
+// PR2352
+void f2(unsigned int m)
+{
+ extern int e[2][m]; // expected-error {{variable length array declaration can not have 'extern' linkage}}
+
+ e[0][0] = 0;
+
+}
+
+// PR2361
+int i;
+int c[][i]; // expected-error {{variably modified type declaration not allowed in file scope}}
+int d[i]; // expected-error {{variable length array declaration not allowed in file scope}}
+
+int (*e)[i]; // expected-error {{variably modified type declaration not allowed in file scope}}
+
+void f3()
+{
+ static int a[i]; // expected-error {{variable length array declaration can not have 'static' storage duration}}
+ extern int b[i]; // expected-error {{variable length array declaration can not have 'extern' linkage}}
+
+ extern int (*c)[i]; // expected-error {{variably modified type declaration can not have 'extern' linkage}}
+ static int (*d)[i];
+}
+