------- Comment #4 from truedfx at gentoo dot org 2008-03-02 10:57 ------- I only came across this bug looking for something else, but anyway, here's a reduced testcase:
template <typename T> class ring {}; template <typename T> ring<T> &operator<<(ring<T>&, T *); class base {}; class derived : public base {}; void f() { ring<base> r; derived *d; r << d; } I believe this code is invalid. The template argument can't be deduced, and you'd need something like template <typename T> class ring {}; template <typename T> struct non_deducible { typename T type; }; template <typename T> ring<T> &operator<<(ring<T>&, typename non_deducible<T>::type *); so that only the first argument is considered when choosing which T to use. Or, more simply, make operator<< a member function. -- truedfx at gentoo dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |truedfx at gentoo dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28330