aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C b/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C
index 8d5457f5944..8e0fbe073fd 100644
--- a/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C
+++ b/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C
@@ -13,12 +13,22 @@ template <class T> struct A {
template <class T> void A<T>::f () { }
extern template struct A<int>;
+// These functions must be defined in a single line, so that, even if
+// constants or pointers are placed in the code section (for example,
+// on the SH), we still get the same line numbers.
+
+void test_f_int () { f(42); } // ERROR - not instantiated
+
+void test_A_int_f () { A<int> a; a.f (); } // ERROR - not instantiated
+
+void test_f_double () { f (2.0); } // gets bogus error
+
+void test_A_double_f () { A<double> b; b.f (); } // gets bogus error
+
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
+ test_f_int ();
+ test_A_int_f ();
+ test_f_double ();
+ test_A_double_f ();
}