new
authorJason Merrill <jason@gcc.gnu.org>
Tue, 3 Feb 1998 01:33:18 +0000 (20:33 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 3 Feb 1998 01:33:18 +0000 (20:33 -0500)
From-SVN: r17612

gcc/testsuite/g++.old-deja/g++.pt/crash1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/crash2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/local6.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec15.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/stmtexpr.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/vaarg.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash1.C b/gcc/testsuite/g++.old-deja/g++.pt/crash1.C
new file mode 100644 (file)
index 0000000..3d3dd5e
--- /dev/null
@@ -0,0 +1,11 @@
+template<class T> class A {
+    public:
+        class subA {};
+};
+
+
+template<class T> class B : public A<T> {
+    public:
+  class subB : public A::subA {}; // ERROR - not a class or namespace
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash2.C b/gcc/testsuite/g++.old-deja/g++.pt/crash2.C
new file mode 100644 (file)
index 0000000..3b900c7
--- /dev/null
@@ -0,0 +1,14 @@
+// Build don't link:
+
+template <class T> 
+struct S1
+{
+  T* t;
+  static int foo;
+};
+
+
+struct S2 : public S1<S2>
+{
+  S2* s;
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local6.C b/gcc/testsuite/g++.old-deja/g++.pt/local6.C
new file mode 100644 (file)
index 0000000..d3f2f4c
--- /dev/null
@@ -0,0 +1,24 @@
+extern "C" void abort();
+
+template <class T>
+int f(T)
+{
+  struct S1 {
+    virtual int foo() { return 1; }
+  };
+
+  struct S2 : public S1 {
+    int foo() { return 2; }
+  };
+
+  S1* s2 = new S2;
+
+  return s2->foo();
+}
+
+
+int main()
+{
+  if (f(3) != 2)
+    abort();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec15.C b/gcc/testsuite/g++.old-deja/g++.pt/spec15.C
new file mode 100644 (file)
index 0000000..0aec143
--- /dev/null
@@ -0,0 +1,49 @@
+extern "C" void abort();
+
+template <class T>
+struct S1
+{
+  static void f();
+};
+
+template <>
+void S1<int>::f() {}
+
+struct S2
+{
+  template <class T>
+  static void g(T);
+};
+
+template <>
+void S2::g(double) {}
+
+template <>
+void S2::g<int>(int) {}
+
+template <class T>
+struct S3
+{
+  template <class U>
+  static int h(U);
+};
+
+template <class T>
+template <>
+int S3<T>::h(int) { return 0; }
+
+template <>
+template <>
+int S3<char>::h(int) { return 1; }
+
+int main()
+{
+  S1<int>::f();
+  S2::g(3.0);
+  S2::g(7);
+
+  if (S3<double>::h(7) != 0) 
+    abort();
+  if (S3<char>::h(7) != 1)
+    abort();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/stmtexpr.C b/gcc/testsuite/g++.old-deja/g++.pt/stmtexpr.C
new file mode 100644 (file)
index 0000000..57ef7e3
--- /dev/null
@@ -0,0 +1,16 @@
+extern "C" void abort();
+
+template <class T>
+T f(T)
+{
+  T t = __extension__ ({ T j = 4; j + 3; });
+  return t;
+}
+
+
+int main()
+{
+  if (f(3) != 7)
+    abort();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/vaarg.C b/gcc/testsuite/g++.old-deja/g++.pt/vaarg.C
new file mode 100644 (file)
index 0000000..56ae0d4
--- /dev/null
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+
+extern "C" void abort();
+
+template <class T>
+T* f(T t, ...)
+{
+  va_list ap;
+
+  va_start(ap, t);
+  T* r = va_arg(ap, T*);
+  va_end(ap);
+
+  return r;
+}
+
+
+struct S 
+{
+};
+
+int main()
+{
+  S s;
+
+  if (f(s, &s) != &s)
+    abort();
+}