Bug or C++ standard: std::vector<int> v ( 20 , 0 ) does not work

Pavel Ganelin pganelin@rth.com
Thu Jan 14 11:41:00 GMT 1999


The following program does not compile. I am not sure about fine details of
the standard, but
==============================================================
#include <vector>
std::vector<int> v ( 20 , 0 ) ;
==============================================================



Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.60/cpp -lang-c++ -v
-undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -Dsparc
-Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__
-D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix)
-Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc)
-Amachine(sparc) /home/pavel/play/eggs2.cc /var/tmp/ccqATX6d.ii
GNU CPP version egcs-2.91.60 19981201 (egcs-1.1.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/lib/g++-include
 /usr/local/include
 /usr/local/sparc-sun-solaris2.6/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.60/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.60/cc1plus
/var/tmp/ccqATX6d.ii -quiet -dumpbase eggs2.cc -version -o /var/tmp/ccR2LIje.s
GNU C++ version egcs-2.91.60 19981201 (egcs-1.1.1 release)
(sparc-sun-solaris2.6) compiled by GNU C version 2.8.1.
/usr/local/include/g++/stl_vector.h: In instantiation of
`iterator_traits<int>':
/usr/local/include/g++/stl_vector.h:115:   instantiated from
`vector<double,__default_alloc_template<false,0> >::vector<int>(int, int)'
/home/pavel/play/eggs2.cc:3:   instantiated from here
/usr/local/include/g++/stl_vector.h:115: no type named `iterator_category'
in `int'
/usr/local/include/g++/stl_vector.h:115: no type named `value_type' in `int'
/usr/local/include/g++/stl_vector.h:115: no type named `difference_type' in
`int'
/usr/local/include/g++/stl_vector.h:115: no type named `pointer' in `int'
/usr/local/include/g++/stl_vector.h:115: no type named `reference' in `int'
/usr/local/include/g++/stl_iterator.h: In function `{error}
iterator_category<int>(const int &)':
/usr/local/include/g++/stl_vector.h:115:   instantiated from
`vector<double,__default_alloc_template<false,0> >::vector<int>(int, int)'
/home/pavel/play/eggs2.cc:3:   instantiated from here
/usr/local/include/g++/stl_iterator.h:126: return-type `{error}' is an
incomplete type
/usr/local/include/g++/stl_iterator.h:126: confused by earlier errors,
bailing out


==================================================
Pavel Ganelin		tel: (703)-471-4981 x 231
RTH Corp.		      fax: (703)-471-5135	
==================================================



More information about the Gcc-bugs mailing list