1// { dg-do run } 2// PRMS Id: 6826 3// Check that unnecessary templates are not instantiated. 4 5template <class T> 6class Test 7{ 8 public: 9 void doThiss(); 10 void doThat(); 11}; 12 13template <class T> 14void Test<T>::doThiss() 15{ 16 T x; 17 18 x.thiss(); 19} 20 21template <class T> 22void Test<T>::doThat() 23{ 24 T x; 25 26 x.that(); 27} 28 29class A 30{ 31 public: 32 void thiss() {} 33}; 34 35class B 36{ 37 public: 38 void that() {} 39}; 40 41int main() 42{ 43 Test<A> a; 44 a.doThiss(); // a.doThat() is not well formed, but then 45 // it's not used so needn't be instantiated. 46 47 Test<B> b; 48 b.doThat(); // simillarly b.doThiss(); 49} 50