aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-04-25 19:55:50 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2009-04-25 19:55:50 +0100
commit92f6fd0b80bedd1ed200c687f2c9f82e1c09cd1a (patch)
tree37e3ee9a7eeffd28c6d57a7ad6c934131c358b1b /gcc/testsuite
parentf88d07724fad4b84d8e73ff30b6f3c16cd832ef3 (diff)
downloadgcc-92f6fd0b80bedd1ed200c687f2c9f82e1c09cd1a.zip
gcc-92f6fd0b80bedd1ed200c687f2c9f82e1c09cd1a.tar.gz
gcc-92f6fd0b80bedd1ed200c687f2c9f82e1c09cd1a.tar.bz2
re PR c/39564 (variably modified function return types not always diagnosed)
PR c/39564 * c-decl.c (grokdeclarator): Diagnose declarations of functions with variably modified return type and no storage class specifiers, except for the case of nested functions. Distinguish extern declarations of functions with variably modified return types from those of objects with variably modified types. testsuite: * gcc.dg/vla-19.c: New test. From-SVN: r146778
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vla-19.c32
2 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f2fdc93..c9cfd92 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2009-04-25 Joseph Myers <joseph@codesourcery.com>
+ PR c/39564
+ * gcc.dg/vla-19.c: New test.
+
+2009-04-25 Joseph Myers <joseph@codesourcery.com>
+
PR preprocessor/39559
* gcc.dg/c99-intconst-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vla-19.c b/gcc/testsuite/gcc.dg/vla-19.c
new file mode 100644
index 0000000..83093c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vla-19.c
@@ -0,0 +1,32 @@
+/* Test diagnostics for variably modified function return types. PR
+ 39564. */
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+int a;
+
+void
+f1 (void)
+{
+ typedef int T[a];
+ extern T *g1 (void); /* { dg-error "non-nested function with variably modified type" } */
+}
+
+void
+f2 (void)
+{
+ extern int (*g2 (void))[a]; /* { dg-error "non-nested function with variably modified type" } */
+}
+
+void
+f3 (void)
+{
+ typedef int T[a];
+ T *g3 (void); /* { dg-error "non-nested function with variably modified type" } */
+}
+
+void
+f4 (void)
+{
+ int (*g4 (void))[a]; /* { dg-error "non-nested function with variably modified type" } */
+}