Hi. Today, while working on libstdc++/28277 I encountered this problem, which currently prevents me from extending the fix to ext/vstring. The below is a rather small self-contained testcase, which current mainline does not compile because of ambiguous overloading, whereas compilers based on the EDG front-end accept it, in strict mode too. Is it a known issue? Thanks.
namespace __gnu_cxx { template<typename _CharT, typename _Traits, typename _Alloc> class __sso_string_base { }; template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base = __sso_string_base> class __versa_string { }; } namespace std { template<typename _CharT, typename _Traits> class basic_ostream; template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>&) { return __os; } } namespace std { template<typename _CharT, typename _Traits> class basic_ostream { template<typename _CharT2, typename _Traits2, typename _Alloc, template <typename, typename, typename> class _Base> friend basic_ostream<_CharT2, _Traits2>& operator<<(basic_ostream<_CharT2, _Traits2>&, const __gnu_cxx::__versa_string<_CharT2, _Traits2, _Alloc, _Base>&); }; } int main() { std::basic_ostream<char, int> bo; __gnu_cxx::__versa_string<char, int, int> vs; bo << vs; } -- Summary: Friendship problem Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pcarlini at suse dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29438