https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92727

--- Comment #11 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #10)
> The bug in this example is that the push_back call needs to make a copy and
> the type is not copyable. It's not a bug that the copy constructor is
> implictly deleted. Knowing that the copy constructor is implicitly deleted
> and why, doesn't actually help you figure out that you need to use std::move.

Indeed, there are 2 cases where you get the error:
- the type is meant to be move-only and you forgot to call std::move
- the type is meant to be copyable, but you did something that results in a
non-copyable type

In the first case, the static assertion is good and to the point. It could even
check if the type is move constructible and suggest using std::move in its
message.
In the second case, I'd love to know what I did wrong, and the extra
information is more than welcome.
As someone who is used to deciphering compiler messages, I tend to prefer
having too much, in case it might be useful, rather than too little. Anyway, I
am talking about verbosity in general, not specifically for this case, maybe
for this case the details are less important, I didn't think too hard about it,
and I am not preventing anyone from introducing the static_assert.

Reply via email to