summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/template27.C
blob: a440397d7ae68ec79c8cbbb9f0a454b9a078c5e5 (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
49
// { dg-do run  }
// 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: 
  void thiss() {}
};

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

int 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(); 
}