Ticket #3780: boost-function-convert-reinterpret_cast-gcc-system-header.diff
File boost-function-convert-reinterpret_cast-gcc-system-header.diff, 2.6 KB (added by , 13 years ago) |
---|
-
boost/function/function_base.hpp
2 2 3 3 // Copyright Douglas Gregor 2001-2006 4 4 // Copyright Emil Dotchevski 2007 5 // Copyright Dean Michael Berris 2009 5 6 // Use, modification and distribution is subject to the Boost Software License, Version 1.0. 6 7 // (See accompanying file LICENSE_1_0.txt or copy at 7 8 // http://www.boost.org/LICENSE_1_0.txt) … … 44 45 # pragma warning( disable : 4127 ) // "conditional expression is constant" 45 46 #endif 46 47 48 #if defined(__GNUC__) 49 // Because GCC complains of strict aliasing problems, we make it 50 // treat the header as a system header, becoming more forgiving with 51 // treating implementation details that may be potentially harmful. 52 # pragma GCC system_header 53 #endif 54 47 55 // Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info. 48 56 #ifdef BOOST_NO_STD_TYPEINFO 49 57 // Embedded VC++ does not have type_info in namespace std … … 314 322 { 315 323 if (op == clone_functor_tag || op == move_functor_tag) { 316 324 const functor_type* in_functor = 317 reinterpret_cast<const functor_type*>(&in_buffer.data);325 static_cast<const functor_type*>(static_cast<void*>(&in_buffer.data)); 318 326 new ((void*)&out_buffer.data) functor_type(*in_functor); 319 327 320 328 if (op == move_functor_tag) { 321 reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor();329 static_cast<functor_type*>(static_cast<void*>(&in_buffer.data))->~Functor(); 322 330 } 323 331 } else if (op == destroy_functor_tag) { 324 332 // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. 325 reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();333 static_cast<functor_type*>(static_cast<void*>(&out_buffer.data))->~Functor(); 326 334 } else if (op == check_functor_type_tag) { 327 335 const detail::sp_typeinfo& check_type 328 336 = *out_buffer.type.type; … … 714 722 715 723 public: // should be protected, but GCC 2.95.3 will fail to allow access 716 724 detail::function::vtable_base* get_vtable() const { 717 return reinterpret_cast<detail::function::vtable_base*>( 718 reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01); 725 return static_cast<detail::function::vtable_base*>( 726 (void*)( 727 (std::size_t(static_cast<void*>(vtable)) & ~(std::size_t(0x01))) 728 ) 729 ); 719 730 } 720 731 721 732 bool has_trivial_copy_and_destroy() const {