This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

Should _GLIBCXX_DEBUG affect tr1/array?


Should the _GLIBCXX_DEBUG macro affect the operation of
std::tr1::array? At the moment it has no effect (I assumed it had and
chased my tail for a while).

The following code:

#define _GLIBCXX_DEBUG
#include <vector>
#include <tr1/array>
#include <iostream>
using namespace std;

int main()
{
	tr1::array<int, 10> a;
	a[11] = 0;

	cerr << "Array OK\n";

	vector<int> b(10);
	b[11] = 0;
	cerr << "Vector OK\n";
}

Produces the output:

Array OK
/usr/include/c++/4.6/debug/vector:313:error: attempt to subscript container
    with out-of-bounds index 11, but container only holds 10 elements.

Objects involved in the operation:
sequence "this" @ 0x0x7fff001872e0 {
  type = NSt7__debug6vectorIiSaIiEEE;
}
Aborted

Is this a bug?

I'm using Ubuntu 11.10's default install of gcc 4.6.1

Regards

-Ed


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