Boost logo

Boost Users :

Subject: [Boost-users] [Test] Funny Business with vector::at() out-of-range
From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2016-02-10 13:52:20

I posted a question a couple of days ago: "Throws 'Escaping' both
BOOST_CHECK_THROW and try{}". I found that BOOST_CHECK_EXCEPTION which
is working for me elsewhere fails the same way. So, an out-of-range
std::vector::at() seems to be the common element.

In the definition of at(), the out-of-range response is handled by
__throw_out_of_range_fmt(). When I looked up that one, I found

   __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__))
     __attribute__((__format__(__gnu_printf__, 1, 2)));

in functexcept.h. To my admittedly less-than-expert eye, there doesn't
seem to be an actual throw() here. On the other hand, the entire file
are entries like this for various exceptions.

There are a lot of Google hits for __throw_out_of_range_fmt, but they
are for unresolved references in links, apparently caused by mixed
version of libraries and object. Everything I've got is compiled linked
for MinGW 64-bit, GCC 5.3.0, 64-bit --std=C++14, BOOST 1_60_1 64-bit so
I get none of those errors.

The problem I'm seeing with my test code is that wrapping a try{} around
BOOST_CHECK_THROW shows that [1] the body of the try doesn't complete;
but at the same time [2] not even a catch(...) can catch the presumed
throw--as if a throw isn't actually being done.

So, where did the throw go?

Merrill Cornish

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at