------- Comment #29 from redi at gcc dot gnu dot org 2009-12-18 00:15 ------- I think it might be worth opening an issue about these functions, it's far too easy for them to cause problems and make the names "next" and "prev" unusable for user functions:
// simplified version of <iterator> and <string> namespace std { template<class Iterator> struct iterator_traits { typedef typename Iterator::difference_type difference_type; typedef typename Iterator::value_type value_type; typedef typename Iterator::pointer pointer; typedef typename Iterator::reference reference; typedef typename Iterator::iterator_category iterator_category; }; template <class InputIterator> InputIterator next(InputIterator x, typename std::iterator_traits<InputIterator>::difference_type n = 1); struct string { }; } // user code struct C { }; void next(C, std::string) { } int main() { C c; next(c, std::string()); } For a user-declared function with an argument of type from namespace std, ADL finds std::next and we get the same error due to instantiating iterator_traits<C> -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40497