------- Comment #2 from bangerth at dealii dot org 2007-09-23 18:09 ------- This indeed looks like a bug. Take this: --------------------- #include <iterator>
namespace M { struct A {}; using std::distance; } namespace N { template <class> struct S {}; class Q : S<M::A> {}; int distance(Q,Q); } int i = distance (N::Q(), N::Q()); ---------------- I would expect this to compile: all arguments to the call to distance() have associated namespace N, so we would expect that the compiler finds N::distance. However, apparently, gcc also performs the derived-to-base conversion to find S<M::A> and concludes that namespace M is also associated from where it tries to use std::distance and gives the error g/x> c++ -c y.cc /usr/include/c++/4.1.2/bits/stl_iterator_base_types.h: In instantiation of 'std::iterator_traits<N::Q>': y.cc:15: instantiated from here /usr/include/c++/4.1.2/bits/stl_iterator_base_types.h:129: error: no type named 'iterator_category' in 'class N::Q' /usr/include/c++/4.1.2/bits/stl_iterator_base_types.h:130: error: no type named 'value_type' in 'class N::Q' /usr/include/c++/4.1.2/bits/stl_iterator_base_types.h:131: error: no type named 'difference_type' in 'class N::Q' /usr/include/c++/4.1.2/bits/stl_iterator_base_types.h:132: error: no type named 'pointer' in 'class N::Q' /usr/include/c++/4.1.2/bits/stl_iterator_base_types.h:133: error: no type named 'reference' in 'class N::Q' It shouldn't be hard to produce a wrong-code bug from this. If someone wants to beat me to producing something without the include file, feel free... W. -- bangerth at dealii dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2007-09-23 18:09:10 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33518