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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> We could constrain the declaration with SFINAE, but the program would still
> be ill-formed (you still can't ask if the construct() call would throw,
> because the declaration would be SFINAE'd out).

Normally, a user should first check if the operation is valid, and only then
check if it throws. The nothrow traits are kind of supposed to do that for you
I think (except that there isn't one for allocator::construct).

(In reply to Jonathan Wakely from comment #2)
> The __use_relocate member of std::vector will check the
> exception-specification without checking if the expression is even valid at
> all:

I think I already hit and fixed some very similar problem (found by the
testsuite) while writing this patch, but it is indeed quite possible that the
issue still exists.
It is possible to imagine a type being relocatable but not movable, although we
may not be ready to support that.
It should be possible to define __use_relocate more lazily so it is only looked
at if we call reserve, push_back, some function that requires it.

Reply via email to