std::string<ThrowOnCopy> behavior

Tim Song t.canens.cpp@gmail.com
Fri Apr 14 19:14:00 GMT 2017


On Fri, Apr 14, 2017 at 9:07 AM, Ivan Baravy <i.baravy@samsung.com> wrote:
> Hello,
>
> I attached an example where I expect an exception on the line 77, but
> nothing happens. GDB reports that memmove is used and thus the
> ThrowOnCopy objects are moved inside of a std::string and no exceptions
> are thrown.
>
> Is this behavior intentional?
>
> Regards,
> Ivan

[strings.general]/1:

This Clause describes components for manipulating sequences of any
non-array POD type. Such types are called char-like types, and objects
of char-like types are called char-like objects or simply characters.

Your ThrowOnCopy isn't a POD. PODs don't throw exceptions when copied.



More information about the Libstdc++ mailing list