Modify

Ticket #3410 (closed Bugs: fixed)

Opened 5 years ago

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

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

Attachments

Change History

comment:1 Changed 4 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 3 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.
View

Add a comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.