This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


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

bug report (was Re: vector's at)


Levente Farkas wrote:
> 
> Benjamin Kosnik wrote:
> >
> > > After a brief and hasty look, it appears that the exception_support.h
> > > header is not defining the preprocessor symbols that stl_vector.h is using.
> > > Those symbols are all defined in stl_range_errors.h, but the functions
> > > declared there aren't in use.  So we /would/ be getting vector<>::at and
> > > throwing things, if we were using that header.
> >
> > I've defined it in stl_config.h. I'll be checking this in shortly.
> >
> > You are right, however. Cleaning up these files is a (low-priority) item..
> 
> I write too soon, since it's not always a problem. is with a 10 lines test
> program it works and find the at function (since it's defined in stl_config.h
> and it's included by stl_range_errors.h and it's included by stl_vector.h),
> BUT when I include one of my own header which include my other headers and
> other system headers it's broken. and the reason that those ifdef evaluated
> az false in that case. today I'll investigate some time to find out what
> include files in which order have to included in order to diappear the at
> function.

so here is a small exmaple of the bug:
-------------------------
#include <queue>
#include <vector>

class A : public std::vector<int>
{
public:
  A(size_type i) : std::vector<int>(i) {}
  reference set(int i) { return at(i); }
};

int main()
{
  A v(6);
  v.set(2) = 4;
}
-------------------------
when I try to compile it, I've got
-------------------------
[lfarkas@ai:/home/lfarkas/tmp]g++ test.cpp
test.cpp: In method `int &A::set (int)':
test.cpp:8: `at' undeclared (first use this function)
test.cpp:8: (Each undeclared identifier is reported only once for each
function it appears in.)
-------------------------
BUT if you comment out the first line, it's compile without error!!
after that I replace the 2 includes with the their contents and found
that the problem is somewhere:
-------------------------
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_vector.h>

//#include <queue>

#include <vector>
-------------------------
if I commnet out bits/stl_vector.h then the error diappear.
anybody can investigate further ?
yours.

 -- Levente
 "The only thing worse than not knowing the truth is
  ruining the bliss of ignorance."

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