[Bug libstdc++/69354] std::thread doesn't support move-only callable objects
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 19 12:06:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69354
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> MoveOnly(MoveOnly&) =delete;
This is not caused by the faxct it's move-only, but by the unconventional
non-const parameter on the deleted copy constructor. If it's a const reference
then move-only types work as expected (and as widely tested in the testsuite!)
I'm tempted to call it a core defect that the defaulted copy constructor
doesn't just get deleted here:
struct MoveOnly
{
MoveOnly(MoveOnly&) =delete;
MoveOnly(MoveOnly&& ){}
MoveOnly(){}
};
struct D : MoveOnly {
D(const D&) = default;
D(D&&) = default;
D() = default;
};
The base class has a deleted copy ctor, so who cares that the derived class
defaults it with a different signature, it should just delete it in the derived
class too. However, 12.8 [class.copy] p11 (11.2) doesn't apply here.
More information about the Gcc-bugs
mailing list