typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) const [with _Key = Unacked2, _Val = Unacked2, _KeyOfValue = std::_Identity, _Compare = compSavedMsg, _Alloc = std::allocator]': C:/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_set.h:427: instantiated from typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::count(const _Key&) const [with _Key = Unacked2, _Compare = compSavedMsg, _Alloc = std::allocatorconst compSavedMsg' as this' argument of bool compSavedMsg::operator()(const SavedMsg&, const SavedMsg&)' discards qualifiers C:/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_set.h:427: instantiated from typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::count(const _Key&) const [with _Key = Unacked2, _Compare = compSavedMsg, _Alloc = std::allocatorconst compSavedMsg' as this' argument of `bool compSavedMsg::operator()(const SavedMsg&, const SavedMsg&)' discards qualifiers make: *** [test] Error 1 This whole thing goes away if I simply comment out my count() call.