list::_M_check_equal_allocators throws
Marc Glisse
marc.glisse@inria.fr
Tue Sep 17 15:30:00 GMT 2013
On Tue, 17 Sep 2013, Jonathan Wakely wrote:
> On 17 September 2013 14:57, Marc Glisse wrote:
>> Hello,
>>
>> I noticed that std::list::_M_check_equal_allocators throws an exception when
>> the allocators should be equal but they are not. This prevents from marking
>> splice noexcept (well, technically we still could, but...).
>>
>> Debug mode, when it detects an error, prints a diagnostic and aborts. Should
>> this list check do the same? It looks more like a logic error than a runtime
>> error to me.
>
> I agree that std::logic_error would have made more sense than
> std::runtime_error, but as it's undefined behaviour anyway I'd be
> happy to just terminate there too. I don't have a strong preference.
By "just terminate", are you happy with replacing the exception with a
simple __builtin_abort() (or an explicit call to std::terminate?) or do
you still want some form of error reporting? I don't think we want to
include iostream or even stdio in <list>, so printing a diagnostic is
complicated.
There is the possibility to leave the throw there, mark the function as
noexcept, and rely on the sad fact that this should call terminate, but I
don't like that much.
--
Marc Glisse
More information about the Libstdc++
mailing list