Compilation of <vector> and self-defined 'distance(a,b)' fails
Benjamin King
king.benjamin@mh-hannover.de
Wed May 26 06:59:00 GMT 2004
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> >'
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minifail.ii.bz2
Type: application/bzip2
Size: 32206 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20040526/16444921/attachment.bin>
More information about the Gcc-bugs
mailing list