Boost C++ Libraries: Ticket #8694: gcc -Wcast-qual warning in boost/function/function_template.hpp https://svn.boost.org/trac10/ticket/8694 <p> 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()); ..... </p> <p> 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&lt;void*&gt;(static_cast&lt;const void*&gt;(f.get_pointer())) or by adding GCC pragmas to disable -Wcast-qual warning in this header file. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8694 Trac 1.4.3 viboes Thu, 30 Jan 2014 18:03:18 GMT <link>https://svn.boost.org/trac10/ticket/8694#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8694#comment:1</guid> <description> <p> Please could you check if you suggestion work and send a patch or do a pull request? </p> </description> <category>Ticket</category> </item> </channel> </rss>