Opened 13 years ago

Closed 13 years ago

#3411 closed Bugs (wontfix)

Warnings when boost::exception is compiled with "-Wold-style-cast"

Reported by: c-rom (-at-) gmx.de Owned by: Emil Dotchevski
Milestone: Boost 1.41.0 Component: exception
Version: Boost 1.40.0 Severity: Cosmetic
Keywords: old-style-cast Cc:

Description

Boost::exception reports warnings when compiled with "-Wold-style-cast".

Please see ticket #2983 which is very similar to this one.

The following code example reproduces the issue with Boost 1.40:

#include <iostream>
#include <boost/exception.hpp>

typedef boost::error_info<struct tag_my_info,int> my_info;

struct my_error: virtual boost::exception, virtual std::exception { };

void f()
{
  throw my_error() << my_info(42);
}

void g()
{
  try
  {
    f();
  }
  catch( my_error & x )
  {
    if( int const * mi=boost::get_error_info<my_info>(x) )
      std::cerr << "My info: " << *mi;
  }
}

The piece of code for this bug report has been compiled with g++ (GCC) 3.4.3:
g++ -Wold-style-cast -o Example -I<PATH_TO_BOOST> Example.cpp

Change History (2)

comment:1 by c-rom (-at-) gmx.de, 13 years ago

Oops, forgot the main()...

int main( int argc, char** argv )
{
  g();
  return 0;
}

;-)

comment:2 by Emil Dotchevski, 13 years ago

Resolution: wontfix
Status: newclosed

Strictly speaking, this is not a cast. I don't plan on "fixing" this.

Note: See TracTickets for help on using tickets.