This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Wcast-qual broken(?) for libstdc++


Mark, might this be a result of your recent parser changes? (And if so,
is this a problem with these changes, or did they just uncover a latent
problem in libstdc++?)

If not, it's a recently introduced libstdc++ problem.

The following simple program

  #include <set>

  using namespace std;

  set<unsigned,less<unsigned> > V;

now generates warnings when compiled with gccvs -Wcast-qual (mainline,
about an hour ago):

/sw/freebsd4/gcc-current/include/c++/3.4/bits/stl_tree.h: In
   member function `std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val,
   _KeyOfValue, _Compare, _Alloc>::_M_end() const [with _Key = unsigned int,
   _Val = unsigned int, _KeyOfValue = std::_Identity<unsigned int>, _Compare =
   std::less<unsigned int>, _Alloc = std::allocator<unsigned int>]':
/sw/freebsd4/gcc-current/include/c++/3.4/bits/stl_tree.h:760:   instantiated from `void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_empty_initialize() [with _Key = unsigned int, _Val = unsigned int, _KeyOfValue = std::_Identity<unsigned int>, _Compare = std::less<unsigned int>, _Alloc = std::allocator<unsigned int>]'
/sw/freebsd4/gcc-current/include/c++/3.4/bits/stl_tree.h:731:   instantiated from `std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Rb_tree(const _Compare&, const typename std::_Rb_tree_base<_Val, _Alloc>::allocator_type&) [with _Key = unsigned int, _Val = unsigned int, _KeyOfValue = std::_Identity<unsigned int>, _Compare = std::less<unsigned int>, _Alloc = std::allocator<unsigned int>]'
/sw/freebsd4/gcc-current/include/c++/3.4/bits/stl_set.h:116:   instantiated from `std::set<_Key, _Compare, _Alloc>::set() [with _Key = unsigned int, _Compare = std::less<unsigned int>, _Alloc = std::allocator<unsigned int>]'
x.cc:5:   instantiated from here
/sw/freebsd4/gcc-current/include/c++/3.4/bits/stl_tree.h:658: warning: cast
   from `const std::_Rb_tree_node_base*' to `std::_Rb_tree_node<unsigned int>*'
   discards qualifiers from pointer target type

Gerald


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]