Debian Codegraph @

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

raw
1 // { dg-do assemble }
2 // Bug: member operator shadows global template in tsubst.
3
4 class ostream;
5
6 template <class TP> class smanip;
7
8 template<class TP>
9 ostream& operator<<(ostream& o, const smanip<TP>& m);
10
11 template <class TP> class smanip {
12 public:
13 friend ostream& operator<< <>(ostream &o, const smanip<TP>&m);
14 };
15
16 template<class TP>
17 ostream& operator<<(ostream& o, const smanip<TP>& m)
18 { return o;}
19
20 class X
21 {
22 public:
23 X operator<<(int); // commenting out this line makes it work!
24 void print(ostream& os);
25 };
26
27 void X::print(ostream& os)
28 {
29 smanip<double> smd;
30 os << smd; // { dg-bogus "" }
31 }