Can someone please explain why in the following code C choses the specialization but A does not? They look the same to me
#include <iostream>
template <typename T=int>
struct C {
int i=3;
};
template<>
struct C<int> {
int i=4;
};
template <typename T=int>
struct A {
A(int, int) {}
};
template <>
struct A<int> {
A(int) {}
};
int main() {
C c;
std::cout << c.i << '\n'; // prints 4
// A a(5); // does not compile
}
I tested using GCC