// { dg-do assemble } // Origin: Gerald Pfeifer #include struct IDENT { enum TYPE { Variable, Constant } type; std::ostream& printTo(std::ostream& out) const { switch (type) { case Variable: out << '_'; break; default: break; } return out; } }; template struct TC { IDENT i; const IDENT& getIdent() const { return i; } }; template inline std::ostream& operator<< (std::ostream& out, const TC &c) { c.getIdent().printTo(out); return out; } void foo(const TC &c) { std::cerr << c << ": " // This line is crucial! << c << std::endl; }