[Boost-bugs] [Boost C++ Libraries] #8693: gcc -Wcast-qual warning in boost/range/algorithm_ext/push_back.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #8693: gcc -Wcast-qual warning in boost/range/algorithm_ext/push_back.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-13 16:39:31


#8693: gcc -Wcast-qual warning in boost/range/algorithm_ext/push_back.hpp
------------------------------+------------------------
 Reporter: ruboam@… | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 When trying boost range library with -Wcast-qual and -Werror flags enabled
 the following error comes up
 boost/range/algorithm_ext/push_back.hpp:30:18: error:
      cast from type 'const Range*' to type 'void*' casts away qualifiers
 [-Werror=cast-qual]
      BOOST_ASSERT( (void*)&on != (void*)&from && .....

 &from is a pointer to const object so the C-style cast (void*)&from casts
 away of constness.
 I think this can be fixed by replacing C-style cast by
 const_cast<void*>(static_cast<const void*>(&from)) or by adding GCC
 pragmas to disable -Wcast-qual warning in this header file

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8693>
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