http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506
--- Comment #5 from Nikolka <tsoae at mail dot ru> 2012-09-09 22:42:03 UTC ---
(In reply to comment #4)
These examples aren't similar. An implicitly defined move constructor performs
direct-initialization of non-static data members with the corresponding members
of the argument, which is interpreted as xvalue (12.8/15). In every such a
direct-initialization all constructors are considered (13.3.1.3), including
constructor templates. Template argument for the parameter U can be deduced as
int, and the produced specialization of the constructor template will have
better match than both copy and move constructors.
Similarly for assignment operators.
> struct A cannot be moved because its move operations are deleted
This is not so in my example, and g++ correctly handles the following case:
template <class T>
struct A
{
A() {}
A(A const volatile &&) = delete;
A &operator =(A const volatile &&) = delete;
template <class U>
A(A<U> &&) {}
template <class U>
A &operator =(A<U> &&) { return *this; }
};
int main()
{
A<int> a = A<int>(); // OK
a = A<int>(); // OK
}