namespace A { template<class> class B { template<class> friend class C; }; } void foo() { A::B<void> b; } namespace A { template<class> class C { }; } using namespace A; void bar() { C<void> c; } => test.cpp: In function ‘void bar()’: hello.cpp:23:5: error: reference to ‘C’ is ambiguous C<void> c; ^ test.cpp:4:38: note: candidates are: template<class> class A::C template<class> friend class C; ^ hello.cpp:15:11: note: template<class> class A::C class C { ^ Note that the error doesn't happen when using "A::C<void> c". The bug is seen with libc++ 3.9.0 headers : #include <map> void foo() { std::map<void*,void*>::iterator it; } #include <set> using namespace std; void bar() { set<void*> s; }
Probable duplicate of bug#59930 (friend class templates injected into wrong namespace).
Fixed by r255780 so closing as a dup, as Richard suggested. *** This bug has been marked as a duplicate of bug 59930 ***