summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-constraint.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-08-26 14:38:38 +0000
committerSteve Naroff <snaroff@apple.com>2007-08-26 14:38:38 +0000
commit5f90ca9904d3cfb464675ea91a91ebaf863f3cd0 (patch)
tree966f0a4ef9a665971987fc138a712dafdbb2715f /clang/test/Sema/array-constraint.c
parentf6dcc9df7e9581549808175554cf9514a6f4d0b8 (diff)
downloadbcm5719-llvm-5f90ca9904d3cfb464675ea91a91ebaf863f3cd0.tar.gz
bcm5719-llvm-5f90ca9904d3cfb464675ea91a91ebaf863f3cd0.zip
Fix bogus warnings (noticed by Chris) with array-constraints.c.
Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit only deals with the array types (DeclaratorCheck::Array), though the rest of this routine should be reviewed. Given the complexity of C declarators, I don't want to change the entire routine now (will discuss with Chris tomorrow). llvm-svn: 41443
Diffstat (limited to 'clang/test/Sema/array-constraint.c')
-rw-r--r--clang/test/Sema/array-constraint.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/test/Sema/array-constraint.c b/clang/test/Sema/array-constraint.c
index fbd4b09b40e..b1095bdc194 100644
--- a/clang/test/Sema/array-constraint.c
+++ b/clang/test/Sema/array-constraint.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast-check -pedantic %s
struct s;
struct s* t (struct s z[]) { // expected-error {{array has incomplete element type}}
@@ -9,3 +9,19 @@ void *k (void l[2]) { // expected-error {{array has incomplete element
return l;
}
+struct vari {
+ int a;
+ int b[];
+};
+
+struct vari *func(struct vari a[]) { // expected-error {{'struct vari' may not be used as an array element due to flexible array member}}
+ return a;
+}
+
+int foo[](void); // expected-error {{'foo' declared as array of functions}}
+
+typedef int (*pfunc)(void);
+
+pfunc xx(int f[](void)) { // expected-error {{'f' declared as array of functions}}
+ return f;
+}
OpenPOWER on IntegriCloud