It seems quite weird. Here you can see the error message is that a convert happens between one type and it fails. If I remove the explicit modifier from Vector3's copy constructor it is fine, no error. Could someone explain why? I'm confused.
template<typename T>
class Vector3 {
public:
explicit Vector3(const Vector3& v) :x(v.x), y(v.y), z(v.z) {}
Vector3() :x(0), y(0), z(0) {}
T x, y, z;
};
template<typename T>
Vector3<T> getVec3() {
return Vector3<T>(); //c2440 "return":cannot convert Vector3<int> to Vector3<int>
}
int main()
{
getVec3<int>();
}