FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / inline14.C
blob5a7ea4bf2a0faf6dc6b438aa7de464f861153f6e
1 // Build don't link:
2 // Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
4 #include <iostream>
6 struct IDENT
7     {
8     enum TYPE { Variable, Constant } type;
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     };
25 template <class T>
26 struct TC
27     {
28     IDENT i;
30     const IDENT& getIdent() const
31         {
32         return i;
33         }
34     };
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     }
43 void foo(const TC<IDENT> &c)
44     {
45     std::cerr << c 
46          << ": " // This line is crucial!
47          << c
48          << std::endl;
49     }