Boost C++ Libraries: Ticket #3410: Warnings in Boost::function when compiled with "-Wold-style-cast" https://svn.boost.org/trac10/ticket/3410 <p> Boost::function reports warnings when compiled with "-Wold-style-cast". </p> <p> There are several old style casts left (besides many "new style casts", so this might be harmonized) in files: </p> <p> boost/function/function_base.hpp </p> <p> boost/function/function_template.hpp </p> <p> Please see ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2983" title="#2983: Bugs: BOOST_CHECK_EQUAL gives error (or warning) &#34;use of old-style cast&#34; ... (closed: fixed)">#2983</a> which is very similar to this one. </p> <p> The following code example reproduces the issue with Boost 1.40: </p> <p> Example.cpp </p> <p> %&lt;------------------------------------- </p> <p> #include &lt;iostream&gt; </p> <p> #include &lt;boost/function.hpp&gt; </p> <p> struct add </p> <p> { </p> <blockquote> <p> int operator()( int arg1, int arg2 ) </p> </blockquote> <blockquote> <p> { </p> </blockquote> <blockquote> <blockquote> <p> return ( arg1 + arg2 ); </p> </blockquote> </blockquote> <blockquote> <p> } </p> </blockquote> <p> }; </p> <p> int main( int argc, char<strong> argv ) </strong></p> <p> { </p> <blockquote> <p> boost::function&lt;int ( int, int )&gt; f; </p> </blockquote> <blockquote> <p> f = add(); </p> </blockquote> <blockquote> <p> std::cout &lt;&lt; f( 2, 2 ) &lt;&lt; std::endl; </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> %&lt;------------------------------------- </p> <p> The piece of code for this bug report has been compiled with g++ (GCC) 3.4.3: </p> <p> g++ -Wold-style-cast -o Example -I&lt;PATH_TO_BOOST&gt; Example.cpp </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3410 Trac 1.4.3 Jeremiah Willcock Tue, 08 Jun 2010 23:55:28 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3410#comment:1 https://svn.boost.org/trac10/ticket/3410#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62614" title="Removed all but one old-style cast, breaking GCC 2.95.3; fixes #3410">[62614]</a>) Removed all but one old-style cast, breaking GCC 2.95.3; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3410" title="#3410: Bugs: Warnings in Boost::function when compiled with &#34;-Wold-style-cast&#34; (closed: fixed)">#3410</a> </p> Ticket Daniel James Mon, 21 Mar 2011 21:32:44 GMT <link>https://svn.boost.org/trac10/ticket/3410#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3410#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/70361" title="Function: Merge from trunk. - Remove extra definition of operator(), ...">[70361]</a>) Function: Merge from trunk. </p> <ul><li>Remove extra definition of operator(), since it's inline anyway. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4765" title="#4765: Bugs: function_template.hpp incorrect placement of inline keyword (closed: fixed)">#4765</a>. </li><li>Make sure that the cv flags are copied when we copy a reference to a function object. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4325" title="#4325: Bugs: boost::function target method fails after copy constructing a function ... (closed: fixed)">#4325</a> </li><li>Fully qualified function calls to avoid ambiguity with new additions to standard. Thanks to Conrad Poelman. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4073" title="#4073: Bugs: &lt;boost/function/function_template.hpp&gt; compile errors with Visual ... (closed: fixed)">#4073</a> </li><li>Remove iterator workaround for newer versions of Visual Age C++. Thanks to 'ccambly'. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3912" title="#3912: Bugs: Boost.Function function30 with vacpp on AIX (closed: fixed)">#3912</a> </li><li>Fix unused variable warning for Visual C++. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3618" title="#3618: Patches: MSVC Warning suppression fix (closed: fixed)">#3618</a> </li><li>Testing flag for Visual C++. </li><li>Removed all but one old-style cast, prevents GCC warnings, but breaks GCC 2.95.3. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3410" title="#3410: Bugs: Warnings in Boost::function when compiled with &#34;-Wold-style-cast&#34; (closed: fixed)">#3410</a> </li><li>Fixed tab and newline issues from inspection report. </li></ul> </description> <category>Ticket</category> </item> </channel> </rss>