It's a mouthful to describe the problem with words, in code it's much simpler:
template <typename T>
struct Vec2
{
Vec2() = default;
Vec2(const Vec2&) = default;
};
template <class T>
struct Point : public Vec2<T>
{
using Vec2<T>::Vec2;
};
void f(const Point<float>&);
void test()
{
f(Vec2<float>{});
}
Vec2<T>
has a copy constructor.Point<float>
is derived fromVec2<float>
and pulls in its constructors.
Expected: Point<float>
should be constructible from Vec2<float>
.
Reality: "No known conversion" error (https://godbolt.org/z/boe86f99K). Why?