Bugzilla – Bug 1781
const and non-const in clang-500.2.79
Last modified: 2013-10-28 08:22:52 UTC
The following error popped up when I updated MacOS to 10.9 (Xcode 5.0.1). [1722/1984] cxx: src/netanim/test/netanim-test.cc -> build/src/netanim/test/netanim-test.cc.3.o In file included from ../src/netanim/model/animation-interface.cc:24: In file included from ./ns3/animation-interface.h:26: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1032:17: error: no matching function for call to object of type 'const ns3::LinkPairCompare' if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1272:36: note: in instantiation of member function 'std::__1::map<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, std::__1::allocator<std::__1::pair<const ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::__find_equal_key' requested here __node_base_pointer& __child = __find_equal_key(__parent, __k); ^ ../src/netanim/model/animation-interface.cc:1807:17: note: in instantiation of member function 'std::__1::map<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, std::__1::allocator<std::__1::pair<const ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::operator[]' requested here linkProperties[p2pPair] = lp; ^ ./ns3/animation-interface.h:62:8: note: candidate function not viable: 'this' argument has type 'const ns3::LinkPairCompare', but method is not marked const bool operator () (P2pLinkNodeIdPair first, P2pLinkNodeIdPair second) ^ In file included from ../src/netanim/model/animation-interface.cc:24: In file included from ./ns3/animation-interface.h:26: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:421:17: error: no matching function for call to object of type 'const ns3::LinkPairCompare' {return static_cast<const _Compare&>(*this)(__x.first, __y);} ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:2085:14: note: in instantiation of member function 'std::__1::__map_value_compare<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, true>::operator()' requested here if (!value_comp()(__root->__value_, __v)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:2011:20: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::pair<ns3::P2pLinkNodeIdPair, ns3::LinkProperties>, std::__1::__map_value_compare<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, true>, std::__1::allocator<std::__1::pair<ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::__lower_bound<ns3::P2pLinkNodeIdPair>' requested here iterator __p = __lower_bound(__v, __root(), __end_node()); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:950:68: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::pair<ns3::P2pLinkNodeIdPair, ns3::LinkProperties>, std::__1::__map_value_compare<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, true>, std::__1::allocator<std::__1::pair<ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::find<ns3::P2pLinkNodeIdPair>' requested here iterator find(const key_type& __k) {return __tree_.find(__k);} ^ ../src/netanim/model/animation-interface.cc:1985:22: note: in instantiation of member function 'std::__1::map<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, std::__1::allocator<std::__1::pair<const ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::find' requested here if (linkProperties.find (p1) != linkProperties.end()) ^ ./ns3/animation-interface.h:62:8: note: candidate function not viable: 'this' argument has type 'const ns3::LinkPairCompare', but method is not marked const bool operator () (P2pLinkNodeIdPair first, P2pLinkNodeIdPair second) ^ In file included from ../src/netanim/model/animation-interface.cc:24: In file included from ./ns3/animation-interface.h:26: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:427:17: error: no matching function for call to object of type 'const ns3::LinkPairCompare' {return static_cast<const _Compare&>(*this)(__x, __y.first);} ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:2012:26: note: in instantiation of member function 'std::__1::__map_value_compare<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, true>::operator()' requested here if (__p != end() && !value_comp()(__v, *__p)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:950:68: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::pair<ns3::P2pLinkNodeIdPair, ns3::LinkProperties>, std::__1::__map_value_compare<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, true>, std::__1::allocator<std::__1::pair<ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::find<ns3::P2pLinkNodeIdPair>' requested here iterator find(const key_type& __k) {return __tree_.find(__k);} ^ ../src/netanim/model/animation-interface.cc:1985:22: note: in instantiation of member function 'std::__1::map<ns3::P2pLinkNodeIdPair, ns3::LinkProperties, ns3::LinkPairCompare, std::__1::allocator<std::__1::pair<const ns3::P2pLinkNodeIdPair, ns3::LinkProperties> > >::find' requested here if (linkProperties.find (p1) != linkProperties.end()) ^ ./ns3/animation-interface.h:62:8: note: candidate function not viable: 'this' argument has type 'const ns3::LinkPairCompare', but method is not marked const bool operator () (P2pLinkNodeIdPair first, P2pLinkNodeIdPair second) ^ 3 errors generated.
changeset 10227 e09c25931173 Please close , if it compiles now
Works, thanks