Example:
template<class T> class A{
public:
A(){}
template<class U> A(A<U> &){}
private:
template<class U> A(A<U>&&){}
};
int main() {
A<int> a1;// legal
A<int> a2(std::move(a1));//legal. it calls implicitly-declared constructor.
}
but when I delete A(){}:
template<class T> class A{
public:
template<class U> A(A<U> &){}
private:
template<class U> A(A<U>&&){}
};
int main() {
A<int> a1;// illegal. 3
A<int> a2(std::move(a1));
}
- If template constructors don't influence implicitly-declared-rules. why does it become illegal?
- If template constructors do influence implicitly-declared-rules, why isn't
A<int> a2(std::move(a1));
illegal in the first example?
Tested in gcc and clang on ubuntu.