Subject: [Boost-bugs] [Boost C++ Libraries] #8694: gcc -Wcast-qual warning in boost/function/function_template.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-13 17:18:05
#8694: gcc -Wcast-qual warning in boost/function/function_template.hpp
--------------------------------------+----------------------
Reporter: Ruben Adamyan <ruboam@â¦> | Owner: dgregor
Type: Bugs | Status: new
Milestone: To Be Determined | Component: function
Version: Boost 1.53.0 | Severity: Cosmetic
Keywords: |
--------------------------------------+----------------------
When using boost function library with -Wcast-qual and -Werror flags
enabled the following error comes up
boost/function/function_template.hpp:628:35 error:
cast from type 'const ...*' to type 'void*' casts away qualifiers [-Werror
=cast-qual]
functor.obj_ref.obj_ptr = (void *)(f.get_pointer()); .....
This warning happens when f.get_pointer() is a const pointer (e.g. it is
originating from boost::cref). Which leads to this C-style cast that casts
away of constness. I think this can be fixed by replacing C-style cast by
const_cast<void*>(static_cast<const void*>(f.get_pointer())) or by adding
GCC pragmas to disable -Wcast-qual warning in this header file.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8694> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC