First: the error message is indeed as given. There is just quotes after the word "argument", which is strange on its own. But here's the problem I'm trying to solve. I'm writing a class that stores a reference of a (template) type internally and should also accept convertible types:
template<typename T>
class Ref {
public:
Ref();
Ref(std::nullptr_t);
explicit Ref(T *value);
Ref(Ref const& value);
template<typename T2, typename std::enable_if<std::is_convertible<T2*, T*>::value, T2>::type>
Ref(Ref<T2> const& value);
template<typename T2, typename std::enable_if<std::is_convertible<T2*, T*>::value, T2>::type>
Ref(Ref<T2> &&value);
private:
T *_value;
};
Now I have 2 classes A and B:
class A {
};
class B : public A {
};
and am trying to assign a Ref instance for B to a Ref variable for class A:
Ref<B> t;
Ref<A> t2(t);
This should actually compile, but I get the mentioned error (clang) for the last 2 constructors (those taking a convertible type), which should actually kick in for that assignment. What needs to be done to make template argument deduction work here?