Boost logo

Boost :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2006-03-30 05:40:48


I have a function in my program that uses BOOST_CHECK* macros but is not
part of a test suite. This is not allowed, of course, and the program
fails, but not as I might expect it do. It gives an access violation in
framework.hpp:

test_unit const&
get( test_unit_id id, test_unit_type t )
{
    test_unit const* res = s_frk_impl().m_test_units[id];

    if( (res->p_type & t) == 0 ) //<<<<<<<<<<<<< access violation here
        throw std::logic_error( "Invalid test unit type" );

    return *res;
}

and the error message "Boost.Test internal framework error: unknown reason".

Obviously, my code is wrong, but I'm wondering whether it indicates a
bug in the Boost library. Should the library trap this and give a more
meaningful error message? Perhaps assert(res != 0); or if (res != 0) ...
else ... is required before the "if" in the get() function.

Paul


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk