https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51577
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> --- And the testcase from PR 61161: struct T { template<typename T> void f(const T &v) { 0 << v; } }; namespace N { struct X {}; struct Y : X {}; void operator<<(int, const X&) {} } void operator<<(int, const N::Y&) = delete; int main() { N::Y d; T().f(d); }