OSDN Git Service

* class.c (resolve_address_of_overloaded_function): Don't
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / inline14.C
1 // { dg-do assemble  }
2 // Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
3
4 #include <iostream>
5
6 struct IDENT
7     {
8     enum TYPE { Variable, Constant } type;
9
10     std::ostream& printTo(std::ostream& out) const
11         {
12         switch (type)
13             {
14             case Variable:
15                 out << '_';
16                 break;
17             default:
18                 break;
19             }
20         return out;
21         }
22     };
23
24
25 template <class T>
26 struct TC
27     {
28     IDENT i;
29
30     const IDENT& getIdent() const
31         {
32         return i;
33         }
34     };
35
36 template <class T>
37 inline std::ostream& operator<< (std::ostream& out, const TC<T> &c)
38     {
39     c.getIdent().printTo(out);
40     return out;
41     }
42
43 void foo(const TC<IDENT> &c)
44     {
45     std::cerr << c 
46          << ": " // This line is crucial!
47          << c
48          << std::endl;
49     }