Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#3410 closed Bugs (fixed)

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

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

Description

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:

boost/function/function_base.hpp

boost/function/function_template.hpp

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

The following code example reproduces the issue with Boost 1.40:

Example.cpp

%<-------------------------------------

#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 (2)

comment:1 by Jeremiah Willcock, 12 years ago

Resolution: fixed
Status: newclosed

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

comment:2 by Daniel James, 12 years ago

(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.
Note: See TracTickets for help on using tickets.