]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Fri, 25 Oct 2002 22:11:19 +0000 (22:11 +0000)
committerNo Author <no-author@gcc.gnu.org>
Fri, 25 Oct 2002 22:11:19 +0000 (22:11 +0000)
'gcc-3_2-branch'.

From-SVN: r58541

gcc/testsuite/g++.dg/ext/vla1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/typename3.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/vla-2.c [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/ext/vla1.C b/gcc/testsuite/g++.dg/ext/vla1.C
new file mode 100644 (file)
index 0000000..bac5aac
--- /dev/null
@@ -0,0 +1,26 @@
+// { dg-do compile }
+
+// Crash tests from PR middle-end/6994.  See also gcc.dg/vla-2.c.
+// A::A is acceptable extended C++ (VLA types brought over from C99);
+// B::B is not, but is closely related to acceptable extended C, though
+// not to acceptable C99.
+
+class A { A (int); };
+
+A::A (int i)
+{
+  int ar[1][i];    // { dg-error "variable-size array" }
+
+  ar[0][0] = 0;
+}
+
+class B { B (int); };
+
+B::B (int i)
+{
+  struct S {
+    int ar[1][i];  // { dg-error "variable-size|variably modified" }
+  } s;
+
+  s.ar[0][0] = 0;  // { dg-error "no member" }
+}
diff --git a/gcc/testsuite/g++.dg/template/typename3.C b/gcc/testsuite/g++.dg/template/typename3.C
new file mode 100644 (file)
index 0000000..1c573ba
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-do compile }
+// crash test - PR 7266
+
+template <class A>
+struct B {
+ typedef A::C::D E;  // { dg-error "no type|parse error" }
+};
diff --git a/gcc/testsuite/gcc.dg/vla-2.c b/gcc/testsuite/gcc.dg/vla-2.c
new file mode 100644 (file)
index 0000000..72c6465
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* These are crash tests related to PR middle-end/6994; see also
+   g++.dg/ext/vla1.C.  Note that at present A and C cannot be inlined.  */
+
+static inline void A (int i)
+{
+  struct S { int ar[1][i]; } s;
+
+  s.ar[0][0] = 0;
+}
+
+void B(void)
+{
+  A(23);
+}
+
+static inline void C (int i)
+{
+  union U { int ar[1][i]; } u;
+
+  u.ar[0][0] = 0;
+}
+
+void D(void)
+{
+  C(23);
+}