This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

Compilation of <vector> and self-defined 'distance(a,b)' fails


Hi GCC team,

I think my gcc has a bug. It fails to compile the following program. Renaming 'distance' to anything else solves this, so I guess that the 'distance' function from <iterator> somehow escaped the std::-namespace.
I couldn't find any description about this with google or in the gcc bug database.

cheers,
  Benjamin


My code (see attachment for .ii): --- #include <vector>

double distance(const std::vector<double> & v1, const std::vector<double> & v2) {
  return 0;
}

int main(int argc, char* argv[])
{
  std::vector<double> v;
  double d;
  d = distance(v, v);
  return 0;
}
---


gcc -v: --- Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs Configured with: /var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --enable-interpreter --enable-java-awt=xlib --with-x --disable-multilib Thread model: posix gcc version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7) ---


Command line: --- gcc -pedantic -Wall minifail.cpp ---


Compiler output: --- /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/bits/stl_iterator_base_types.h: In instantiation of `std::iterator_traits<std::vector<double, std::allocator<double> > >': minifail.cpp:11: instantiated from here /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/bits/stl_iterator_base_types.h:126: error: no type named `iterator_category' in `class std::vector<double, std::allocator<double> >' ---

Attachment: minifail.ii.bz2
Description: application/bzip2


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