aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/array-constraint.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-08-31 17:20:07 +0000
committerSteve Naroff <snaroff@apple.com>2007-08-31 17:20:07 +0000
commitd7444aac1af1c2c1d5e5b7467ecf6006ee2d8abe (patch)
treea93b435347cf195fc0ef803eaeea7db00a88216b /test/Sema/array-constraint.c
parent49a436de368c18c3fc669037aa5211b973b076a9 (diff)
Removed Sema::VerifyConstantArrayType(). With the new Array/ConstantArray/VariableArray nodes, this
routine was causing more trouble than it was worth. Anders/Chris noticed that it could return an error code without emiting a diagnostic (which results in an silent invalid decl, which should *never* happen). In addition, this routine didn't work well for typedefs and field decls. Lastly, it didn't consider that initializers aren't in place yet. Added Type::getAsConstantArrayType(), Type::getAsVariableArrayType(), Type::getAsVariablyModifiedType(), and Type::isVariablyModifiedType(); Modified Sema::ParseDeclarator() and Sema::ParseField() to use the new predicates. Also added a FIXME for the initializer omission. Also added a missing test for "static" @ file scope. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/array-constraint.c')
-rw-r--r--test/Sema/array-constraint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Sema/array-constraint.c b/test/Sema/array-constraint.c
index 1ca3cd7aec..867d4e7cbf 100644
--- a/test/Sema/array-constraint.c
+++ b/test/Sema/array-constraint.c
@@ -39,3 +39,13 @@ void check_size() {
int zero_size[0]; // expected-warning{{zero size arrays are an extension}}
}
+static int I;
+typedef int TA[I]; // expected-error {{variable length array declared outside of any function}}
+
+void strFunc(char *);
+const char staticAry[] = "test";
+int checkStaticAry() {
+ strFunc(staticAry); // expected-warning{{passing 'char const []' to 'char *' discards qualifiers}}
+}
+
+