Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 901 - STL vector with initializer problem.
Summary: STL vector with initializer problem.
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs
Version: 5.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Preston Brown
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-01-20 20:59 UTC by swift
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-03-22 20:25:48 UTC

Attachments (Terms of Use)

Description swift 1999-01-20 20:59:55 UTC

I've encountered an odd problem with compiling legacy code
that uses STL.  I recently upgraded to RH 5.2 {egcs
(egcs-2.90.29 980515 (egcs-1.0.3 release))} from RH 5.0 {gcc
(version}.  The platform is a PC and the processor
is a Pentium II.  Below is sample code that exercises the

   #include <vector>

   int main(void)
      vector<int> a(10,0);

Here is a transcript of a compilation session:

egcs -o foo -lstdc++
/usr/include/g++/stl_vector.h:113: no type named
`iterator_category' in `int'
/usr/include/g++/stl_vector.h:113: no type named
`value_type' in `int'
/usr/include/g++/stl_vector.h:113: no type named
`difference_type' in `int'
/usr/include/g++/stl_vector.h:113: no type named `pointer'
in `int'
/usr/include/g++/stl_vector.h:113: no type named `reference'
in `int'
/usr/include/g++/stl_iterator.h: In function `{error}
iterator_category<int>(const int &)':
/usr/include/g++/stl_iterator.h:126: confused by earlier
errors, bailing out

Compilation exited abnormally with code 1 at Wed Jan 20

The problem appears to originate with the use of an integer
initializer in the constructor.  If I use an unsigned int as
an initializer like this: {vector<int> a(10,0U);} or even a
float like this: {vector<int> a(10,0.0);} then the problem
disappears.  Similarly, it doesn't matter whether the vector
itself is integer, float, or double ... the same compilation
error occurs if an integer is used in the initialization

So what bit of nefarious activity is responsible here?


Comment 1 Preston Brown 1999-03-22 20:25:59 UTC
This appears to have been a compiler problem.  The code fragment
compiles without trouble using egcs 1.1.2, which ships with Red Hat
Linux 5.9 beta, and will be the default Red Hat Linux 6.0 compiler as

Note You need to log in before you can comment on or make changes to this bug.