1// { dg-do assemble  }
2// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
3
4#include <iostream>
5
6struct 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
25template <class T>
26struct TC
27    {
28    IDENT i;
29
30    const IDENT& getIdent() const
31        {
32	return i;
33	}
34    };
35
36template <class T>
37inline std::ostream& operator<< (std::ostream& out, const TC<T> &c)
38    {
39    c.getIdent().printTo(out);
40    return out;
41    }
42
43void foo(const TC<IDENT> &c)
44    {
45    std::cerr << c
46         << ": " // This line is crucial!
47         << c
48         << std::endl;
49    }
50