Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-03-30 11:52:29


>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

I will have to look into this. Could you provide a simple test program?

Gennadiy


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