aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c90-flex-array-2.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-02-06 20:12:10 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2009-02-06 20:12:10 +0000
commit1de2c900e018849ddc8b3b4e682d05fb3b697fbe (patch)
tree3b7774a90eed648f1e7bacbb2a0a05aaea2a1422 /gcc/testsuite/gcc.dg/c90-flex-array-2.c
parente901811a8be42e9c292324550c84be46d4f27e4c (diff)
downloadgcc-1de2c900e018849ddc8b3b4e682d05fb3b697fbe.zip
gcc-1de2c900e018849ddc8b3b4e682d05fb3b697fbe.tar.gz
gcc-1de2c900e018849ddc8b3b4e682d05fb3b697fbe.tar.bz2
re PR c/36432 (“incompatible pointer type” with pointer to array as a struct member)
PR c/36432 * c-decl.c (grokdeclarator): Don't treat [] declarators in fields as indicating flexible array members unless the field itself is being declarared as the incomplete array. testsuite: * gcc.dg/c90-flex-array-2.c, gcc.dg/c99-flex-array-6.c: New tests. From-SVN: r143989
Diffstat (limited to 'gcc/testsuite/gcc.dg/c90-flex-array-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/c90-flex-array-2.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c90-flex-array-2.c b/gcc/testsuite/gcc.dg/c90-flex-array-2.c
new file mode 100644
index 0000000..425ce84
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c90-flex-array-2.c
@@ -0,0 +1,15 @@
+/* [] does not indicate a flexible array member unless it is the field
+ itself being declared as an incomplete array type rather than a
+ pointer or other type derived from such a type. PR 36432. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+void
+f (void)
+{
+ int a[3];
+ int (*p)[];
+ struct { int (*p)[]; } s;
+ p = &a;
+ s.p = &a;
+}