------- Comment #3 from jason at redhat dot com 2010-08-09 13:22 ------- Subject: Re: [C++0x] Can't copy-construct "tuple<int,int,int>" from "const tuple<int,int,int>" rvalue
For tuple_m, you have a variadic template constructor that can take *any* arguments whatsoever, and will therefore be a better match than anything that doesn't have a specific constructor. In this case, you're trying to create a tuple_m from a const tuple_m rvalue, and therefore the variadic template is instantiated to form tuple_m(const tuple_m&&), which is a better match than either tuple_m(const tuple_m&) or tuple_m(tuple_m&&). For tuple_2, the T&& constructor requires two arguments, so this isn't an issue. This is the same issue that we had with thread; I worked around that for the non-const lvalue case by adding thread(thread&) = delete, and you could do the same here by adding a const tuple_m&& overload. But in general, I think any time you have a variadic constructor that can take a single T&&, you probably want to use SFINAE to make sure that it isn't chosen for a single argument of the enclosing class type. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45228