Ticket #3410 (closed Bugs: fixed)

Opened 8 years ago

Last modified 6 years ago

Warnings in Boost::function when compiled with "-Wold-style-cast"

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


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

There are several old style casts left (besides many "new style casts", so this might be harmonized) in files:



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/function.hpp>

struct add


int operator()( int arg1, int arg2 )


return ( arg1 + arg2 );



int main( int argc, char argv )


boost::function<int ( int, int )> f;

f = add();

std::cout << f( 2, 2 ) << std::endl;

return 0;



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

comment:1 Changed 7 years ago by jewillco

  • Status changed from new to closed
  • Resolution set to fixed

(In [62614]) Removed all but one old-style cast, breaking GCC 2.95.3; fixes #3410

comment:2 Changed 6 years ago by danieljames

(In [70361]) Function: Merge from trunk.

  • Remove extra definition of operator(), since it's inline anyway. Fixes #4765.
  • Make sure that the cv flags are copied when we copy a reference to a function object. Fixes #4325
  • Fully qualified function calls to avoid ambiguity with new additions to standard. Thanks to Conrad Poelman. Fixes #4073
  • Remove iterator workaround for newer versions of Visual Age C++. Thanks to 'ccambly'. Fixes #3912
  • Fix unused variable warning for Visual C++. Fixes #3618
  • Testing flag for Visual C++.
  • Removed all but one old-style cast, prevents GCC warnings, but breaks GCC 2.95.3. Fixes #3410
  • Fixed tab and newline issues from inspection report.

Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.