Hi Team, in my code,I had to write like below: const int* p = boost::get_error_infoboost::throw_line(exception); But while building the code,I am facing issue like below: error C2683: 'dynamic_cast':'boost::exception_ptr' is not a polymorphic type.. Then I have added one dummy virtual function in exception_ptr class then this issue got resolved but I am getting some test cases failed at this line: Const int* p = boost::get_error_infoboost::throw_line(exception); Please help me where will be the issue is.what will be the solution.
On Wed, 22 Sept 2021 at 19:41, rajesh daggumati via Boost
Hi Team, in my code,I had to write like below: const int* p = boost::get_error_infoboost::throw_line(exception); But while building the code,I am facing issue like below: error C2683: 'dynamic_cast':'boost::exception_ptr' is not a polymorphic type..
Likely, the type of the `exception` object is not polymorphic. https://godbolt.org/z/6fsqKc4vY The subject of your post is meaningless, perhaps try a better subject next time. Best regards -- Mateusz Loskot, http://mateusz.loskot.net
On Wed, Sep 22, 2021 at 10:42 AM rajesh daggumati via Boost < boost@lists.boost.org> wrote:
Hi Team, in my code,I had to write like below: const int* p = boost::get_error_infoboost::throw_line(exception); But while building the code,I am facing issue like below: error C2683: 'dynamic_cast':'boost::exception_ptr' is not a polymorphic type..
Then I have added one dummy virtual function in exception_ptr class then this issue got resolved but I am getting some test cases failed at this line: Const int* p = boost::get_error_infoboost::throw_line(exception);
Post a complete program please.
rajesh daggumati wrote:
Hi Team, in my code,I had to write like below: const int* p = boost::get_error_infoboost::throw_line(exception); But while building the code,I am facing issue like below: error C2683: 'dynamic_cast':'boost::exception_ptr' is not a polymorphic type..
This implies that `exception` is of type `boost::exception_ptr`. This is not an exception type, it's an opaque pointer that refers to an exception. The only thing you can do with this pointer is tell it to rethrow the exception it refers to. So: try { boost::rethrow_exception( exception ); } catch( std::exception const& x ) { const int* p = boost::get_error_infoboost::throw_line(x); // use p here }
participants (4)
-
Emil Dotchevski
-
Mateusz Loskot
-
Peter Dimov
-
rajesh daggumati