This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: std::string<ThrowOnCopy> behavior
- From: Tim Song <t dot canens dot cpp at gmail dot com>
- To: Ivan Baravy <i dot baravy at samsung dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 14 Apr 2017 15:13:56 -0400
- Subject: Re: std::string<ThrowOnCopy> behavior
- Authentication-results: sourceware.org; auth=none
- References: <CGME20170414130729eucas1p1ad084f642d2a634d4137c3b89c9d5d8c@eucas1p1.samsung.com> <9fe24e89-20f6-3a7e-9178-5487ea7a6c75@samsung.com>
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.