Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.jason/template25.C

raw
1 // { dg-do run }
2 // PRMS Id: 6393
3 // Bug: g++ is too lax in considering UPTs to be the same.
4
5 template <class R, class T>
6 class Bar
7 {
8 public:
9 R do_bar (T arg);
10 };
11
12
13 template <class T>
14 class Foo
15 {
16 T i;
17
18 public:
19 void do_foo () {}
20 void do_foo (T const & t) {}
21 void do_foo (Bar<char, T> const & bar); // {} Put the body here and it works
22 void do_foo (Bar<T, T> const & bar); // {} Put the body here and it works
23 };
24
25 // These definitions don't work
26
27 template <class T>
28 inline void Foo<T>::
29 do_foo (Bar<char, T> const & bar)
30 {}
31
32 template <class T>
33 inline void Foo<T>::
34 do_foo (Bar<T, T> const & bar)
35 {}
36
37
38 int main ()
39 { int i;
40 Bar<char, int> bar1;
41 Bar<int, int> bar2;
42 Foo<int> foo;
43 foo.do_foo();
44 foo.do_foo(i);
45 foo.do_foo(bar1);
46 foo.do_foo(bar2);
47
48 return 0;
49 }