Opened 7 years ago

Last modified 7 years ago

#6551 new Bugs

BOOST_CLASS_VERSION emits use of old-style cast when compiling with -Wold-style-cast

Reported by: andre.kwakernaak@… Owned by: Aleksey Gurtovoy
Milestone: To Be Determined Component: mpl
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:


In our project we want to compile all code with -Wold-style-cast and treat warnings as errors. We pass the boost/include directory with -isystem to gcc. This keeps warnings from boost from obfuscating our build output. However if a macro from constains warnings we still get them.

BOOST_CLASS_VERSION uses BOOST_MPL_ASSERT which causes the warning. I changed the old style casts to c++ casts in the macro's from boost/mpl/assert.hpp.

Attachments (1)

no_old_style_cast_in_macros.patch (1.2 KB) - added by andre.kwakernaak@… 7 years ago.
patch to change old style casts to c++ casts in mpl/assert.hpp

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by andre.kwakernaak@…

patch to change old style casts to c++ casts in mpl/assert.hpp

comment:1 Changed 7 years ago by Ulrich Eckhardt <ulrich.eckhardt@…>

Two things:

  1. That should be a static_cast, not a reinterpret_cast.
  2. I wonder if instead of casting a null to an according function pointer type, it would be possible to tell assert_arg explicitly like assert_arg<void (*)(Pred)>(0, ...) and then rely on the conversion of 0 to the according type to do the right thing.
Note: See TracTickets for help on using tickets.