std::string<ThrowOnCopy> behavior

Ivan Baravy i.baravy@samsung.com
Mon Apr 17 12:40:00 GMT 2017


Tim,

thank you for the answer, this helps me a lot.

Regards,
Ivan

On 04/14/2017 10:13 PM, Tim Song wrote:
> 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