[patch] fix libstdc++/60734 - invalid static_cast

Jonathan Wakely jwakely@redhat.com
Tue Apr 15 11:15:00 GMT 2014


Tested x86_64-linux, committed to trunk.

I intend to fix this for 4.9.1 and 4.8.3 too.


-------------- next part --------------
commit 1e13d4d7791a665bb254e0d53e96d3a5ab925023
Author: Jonathan Wakely <accu@kayari.org>
Date:   Tue Apr 15 00:36:35 2014 +0100

    	PR libstdc++/60734
    	* include/bits/stl_tree.h (_Rb_tree::_M_end): Fix invalid cast.

diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 4bc3c60..288c9fa 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -526,11 +526,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       _Link_type
       _M_end() _GLIBCXX_NOEXCEPT
-      { return static_cast<_Link_type>(&this->_M_impl._M_header); }
+      { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); }
 
       _Const_Link_type
       _M_end() const _GLIBCXX_NOEXCEPT
-      { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
+      { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); }
 
       static const_reference
       _S_value(_Const_Link_type __x)


More information about the Libstdc++ mailing list