https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89636
Bug ID: 89636
Summary: Duplicate diagnostic when resolving ambiguity between
variable and function template using implicit typename
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blitzrakete at gmail dot com
Target Milestone: ---
namespace N {
inline namespace A { template <typename T> int f(typename T::type); }
inline namespace B { template <typename T> int f(T::type); }
}
template <typename T>
int N::f(T::type); // ill-formed
For the above code, compiled with -std=c++2a, gcc generates:
<source>:7:5: error: reference to 'f' is ambiguous
7 | int N::f(T::type); // ill-formed
| ^
<source>:2:50: note: candidates are: 'template<class T> int N::A::f(typename
T::type)'
2 | inline namespace A { template <typename T> int f(typename T::type); }
| ^
<source>:3:50: note: 'template<class T> int N::B::f<T>'
3 | inline namespace B { template <typename T> int f(T::type); }
| ^
<source>:7:17: error: reference to 'N::f' is ambiguous
7 | int N::f(T::type); // ill-formed
| ^
<source>:2:50: note: candidates are: 'template<class T> int N::A::f(typename
T::type)'
2 | inline namespace A { template <typename T> int f(typename T::type); }
| ^
<source>:3:50: note: 'template<class T> int N::B::f<T>'
3 | inline namespace B { template <typename T> int f(T::type); }
| ^
Note the duplicate diagnostic. First it errors on just `f` being ambiguous,
then it does the same thing with `N::f`, but they're the same. I'd expect only
the second one to be emitted.