Take the following example (https://godbolt.org/z/ouX3Vz):
template<typename T>
using A = T;
template<typename T, typename V>
using A = V; // Why is this not allowed?
template<typename T>
void B() {}
template<typename T, typename V>
void B() {} // Yet this is allowed?
int main() {
A<int> hello = 10; // Allowed, T=int
A<double> world = 20.0; // Allowed, T=double
// A<int, int> bad = 20; // Not allowed, T=int, V=double?
B<int>();
B<int, int>();
}
We are allowed to have two function templates for B
as the parameters differ, however, we are not allowed to have two alias templates for A
despite differing parameters.
Is this an oversight in the standard or is there a rationale that I am missing? Are there any references to the standard describing this behavior?