OSDN Git Service

new
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 3 Jun 2000 00:02:48 +0000 (00:02 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 3 Jun 2000 00:02:48 +0000 (00:02 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34366 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.ext/instantiate3.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C b/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C
new file mode 100644 (file)
index 0000000..43cc9f6
--- /dev/null
@@ -0,0 +1,23 @@
+// Test that 'extern template' suppresses instantiations.
+// Special g++ Options: -g -O
+
+// Ignore the 'ld returned 1' message from collect2.
+// excess errors test - XFAIL *-*-*
+
+template <class T> void f (T) { }
+extern template void f (int);
+
+template <class T> struct A {
+  void f () { }
+};
+extern template struct A<int>;
+
+int main ()
+{
+  f (42);                      // ERROR - not instantiated
+  A<int> a;
+  a.f ();                      // ERROR - not instantiated
+  f (2.0);                     // gets bogus error
+  A<double> b;
+  b.f ();                      // gets bogus error
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C b/gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C
new file mode 100644 (file)
index 0000000..05c3e20
--- /dev/null
@@ -0,0 +1,17 @@
+// Test that 'static template' instantiates statics.
+// Special g++ Options: -g -fno-implicit-templates
+
+// Ignore the 'ld returned 1' message from collect2.
+// excess errors test - XFAIL *-*-*
+
+template <class T> struct A {
+  static T t;
+};
+template <class T> T A<T>::t = 0;
+static template struct A<int>;
+
+int main ()
+{
+  A<int>::t = 42;              // gets bogus error
+  A<char>::t = 42;             // ERROR - not instantiated
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/instantiate3.C b/gcc/testsuite/g++.old-deja/g++.ext/instantiate3.C
new file mode 100644 (file)
index 0000000..7d710c4
--- /dev/null
@@ -0,0 +1,17 @@
+// Test that 'inline template' instantiates the vtable.
+// Special g++ Options: -g -O -fno-implicit-templates
+
+// Ignore the 'ld returned 1' message from collect2.
+// excess errors test - XFAIL *-*-*
+
+template <class T> struct A {
+  virtual void f () { }
+};
+inline template struct A<int>;
+
+A<int> a;                      // gets bogus error
+A<char> b;                     // ERROR - not instantiated
+
+int main ()
+{
+}