Boost logo

Boost Users :

Subject: [Boost-users] Incorrect assertion in Boost.Exception?
From: Thorsten Dahlheimer (tdahlheim_at_[hidden])
Date: 2012-11-30 10:26:14


Hello,

we want to use Boost.Exception (1.47.0) with MS Visual Studio 2010 in a project that consists of several DLLs and a main executable.
We have situations where we store an error_info into an exception from inside a DLL and access it again from another DLL/the EXE, e.g.:

dll.cpp:
  void func()
  {
    BOOST_THROW_EXCEPTION(my_exception() << my_info(42));
  }

exe.cpp:
  try
  {
    func();
  }
  catch (boost::exception& e)
  {
    std::cout << *boost::get_error_info<my_info>(e) << std::endl;
  }

Now at runtime, when the error info is accessed, the following assertion in boost::exception_detail::error_info_container_impl::get() fails:
  BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
As far as we can see, this happens because MSVC++ uses seperate type_info objects in each dll/exe, and the above assertion compares pointers to type_infos instead of the objects themselves.
We believe this is a bug on the Boost side, since type_info objects for the same type are generally not guaranteed to be unique. Are we correct with that?

Thanks,
Thorsten


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net