[cfe-dev] [RFC][libcxx] Fix and maintain the no-exceptions build of libcxx

Marshall Clow via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 2 08:23:48 PST 2015


On Thu, Oct 29, 2015 at 6:53 AM, Asiri Rathnayake via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
>
>
[snip]

>
>
> Note that it's not just the tests that need to be updated. For example,
> take
>
> unordered_map::at(key) definition:
>
>
>
> template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
>
> _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type&
> __k)
>
> {
>
>     iterator __i = find(__k);
>
> #ifndef _LIBCPP_NO_EXCEPTIONS
>
>     if (__i == end())
>
>         throw out_of_range("unordered_map::at: key not found");
>
> #endif
>
>     return __i->second;
>
> }
>
>
>
> Here the behavior is not correct w.r.t no-exceptions use case, __i == end()
>
> should instead call abort(). My local patch includes updates to tests as
> well
>
> as fixes for omissions like this one.
>
>
>
I find it amusing that you think that there's a "correct behavior" when the
standard specifies that an operation should throw an exception and you have
disabled exceptions.

-- Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151102/a486260e/attachment.html>


More information about the cfe-dev mailing list