https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51577

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testcase from PR65336:


extern "C" int puts(const char*);

struct ostream {} cout; 
template<typename T> struct A{ T t; };

struct B{};
struct C : public B{};

ostream& operator<< (ostream& out, const B&) 
  { puts("right"); return out; }

namespace {
template<typename T>
ostream& operator<< (ostream& out, const A<T>&v) 
  { return out << v.t; }

ostream& operator<< (ostream& out, const C&) 
  { puts("wrong"); return out; }
}

int main(){
  A<C> a;
  cout << a;
}

Reply via email to