aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/template27.C
blob: 3806da0ac7fbaf393b23201b7e23927726b74c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// PRMS Id: 6826
// Check that unnecessary templates are not instantiated.

template <class T> 
class Test 
{ 
 public: 
  void doThiss(); 
  void doThat(); 
};

template <class T> 
void Test<T>::doThiss() 
{ 
  T x; 

  x.thiss(); 
} 

template <class T> 
void Test<T>::doThat() 
{ 
  T x; 

  x.that(); 
} 

class A 
{ 
 public: 
  thiss() {}; 
};

class B
{ 
 public: 
  that() {}; 
};

main() 
{ 
  Test<A> a; 
  a.doThiss();			// a.doThat() is not well formed, but then
				// it's not used so needn't be instantiated. 
  
  Test<B> b;
  b.doThat();			// simillarly b.doThiss(); 
}