summaryrefslogtreecommitdiffstats
path: root/clang/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
commit096dd942cfb57f613dd41aa6114e6d076cd24212 (patch)
tree1a45cc829f59a9764dc0934ef2a598055c5aa689 /clang/test/Sema/array-constraint.c
parent527ec81d8be914971edcf5142679099a869c97af (diff)
downloadbcm5719-llvm-096dd942cfb57f613dd41aa6114e6d076cd24212.tar.gz
bcm5719-llvm-096dd942cfb57f613dd41aa6114e6d076cd24212.zip
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. llvm-svn: 41647
Diffstat (limited to 'clang/test/Sema/array-constraint.c')
-rw-r--r--clang/test/Sema/array-constraint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Sema/array-constraint.c b/clang/test/Sema/array-constraint.c
index 1ca3cd7aec9..867d4e7cbf2 100644
--- a/clang/test/Sema/array-constraint.c
+++ b/clang/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}}
+}
+
+
OpenPOWER on IntegriCloud