$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [TEST] Throws "Escaping" both BOOST_CHECK_THROW and try{}
From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2016-02-08 19:53:20
I'm running Windows 10, 64-bit; MinGW 64-bit; GCC 5.3 64-bit; and BOOST 
1_60_1
Here is the relevant test code:
[319] BOOST_CHECK_THROW(throw std::out_of_range("BOOST_CK_THROW test"), 
std::out_of_range);
[320] try {
[321]     std::cerr << "arcsSize()" << std::endl;
[322]     empty1.arcsSize(Operand::DEFAULT_ARC_SET+1);
[323]     std::cerr << "arcsSize() did not throw" << std::endl;
[324]    }//try
[325] catch (const std::out_of_range& ex)
[326]     { std::cerr << "out_of_range caught=|" << ex.what() << "|" << 
std::endl; }
[327] catch (...) { std::cerr << "something else caught" << std::endl; }
[328]
[329] BOOST_CHECK_THROW(empty1.arcsSize(Operand::DEFAULT_ARC_SET+1), 
std::out_of_range);
The original code was just the last line, line [329].  [319]-[327] was 
added in an attempt
to characterize the problem.  The error [329] got by itself was:
terminate called after throwing an instance of 'std::out_of_range'
   what():  vector::_M_range_check: __n (which is 1) >= this->size() 
(which is 1)
This application has requested the Runtime to terminate it in an unusual 
way.
Please contact the application's support team for more information.
SIGABRT intercepted; converted to exit(EXIT_FAILURE).
arcSize() is implemented with std::vector::at() and the index is 
out-of-range, so it's
supposed to throw std::out_of_range.  That's what was detected, so why 
did it
terminate the program? (The last line comes from my SIGABRT handler.
Without it, the test executable ends up locked and can't be deleted.)
Adding in all of the test lines shown above gives;
[319] Operand_Test.cpp(319): info:
    check 'exception "std::out_of_range" raised as expected' has passed
[321] arcsSize()
terminate called after throwing an instance of 'std::out_of_range'
   what():  vector::_M_range_check: __n (which is 1) >= this->size() 
(which is 1)
This application has requested the Runtime to terminate it in an unusual 
way.
Please contact the application's support team for more information.
SIGABRT intercepted; converted to exit(EXIT_FAILURE).
Notice the explicit throw in line [319] is detected and handled 
properly.  However,
the arcSize() call from inside the try block throws, but is not caught 
by even
catch(...) {}.
Can anyone help me see what's going on here?
Merrill Cornish