diff options
| -rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C | 23 | ||||
| -rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C | 17 | ||||
| -rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ext/instantiate3.C | 17 |
3 files changed, 57 insertions, 0 deletions
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 index 00000000000..43cc9f67a0c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C @@ -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 index 00000000000..05c3e202864 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C @@ -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 index 00000000000..7d710c4ba21 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/instantiate3.C @@ -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 () +{ +} |

