Opened 11 years ago

Last modified 11 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:

Description

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@… 11 years ago.
patch to change old style casts to c++ casts in mpl/assert.hpp

Download all attachments as: .zip

Change History (2)

by andre.kwakernaak@…, 11 years ago

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

comment:1 by Ulrich Eckhardt <ulrich.eckhardt@…>, 11 years ago

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.