--- /dev/null
+// 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
+}
--- /dev/null
+// 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
+}
--- /dev/null
+// 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 ()
+{
+}