Given the code
#include <type_traits>
template <auto I, class T>
struct C {};
template <auto I, class T>
void func(C<I, T> c) {}
struct C2 : C<0, int>, C<0u, long> {};
int main() {
static_assert(!std::is_same<C<0, int>, C<0u, long>>::value);
C2 c2;
func<0>(c2); // Error
return 0;
}
I get the error (from GCC):
<source>:15:15: note: 'C<0, T>' is an ambiguous base class of 'C2'
15 | func<0>(c2);
| ^
How come a class template (C<I, T>) can be an ambiguous base class when the instantiations (C<0, int> and C<0u, long>) are clearly distinct types?
Edit: I forgot the partial specialization.