diff gcc/testsuite/gcc.dg/vla-19.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/vla-19.c	Fri Oct 27 22:46:09 2017 +0900
@@ -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" } */
+}