Bug 7752 - vector<int>[] does not work on gdb 5.1.1, gcc2.95.3
Summary: vector<int>[] does not work on gdb 5.1.1, gcc2.95.3
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.1
: P3 normal
Target Milestone: 7.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-13 20:28 UTC by tspivey8
Modified: 2010-01-20 20:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tspivey8 2002-08-14 03:28:00 UTC
[Converted from Gnats 647]

when i try to debug this short program, i can't access a[0] or a[1].
i'm new at this, so i might be doing something wrong.
#include <vector>
main(){
vector<int> a;
a.push_back(1);
a.push_back(132);
}

Release:
5.1.1

Environment:
Linux fast.hn 2.4.19-rc1-ac3-gentoo-r1 #1 Wed Jul 24 14:48:12 UTC 2002 i586 GenuineIntel
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-linux-gnu".
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)

How-To-Repeat:
compile the program (included in description field) like:
g++ -g file.cpp
gdb ./a.out
break main
next until the } appears
print a
print a[0]
print a[1]
Comment 1 Tom Tromey 2010-01-20 20:07:27 UTC
This works with recent gcc and gdb.
You have to make sure that operator[] is instantiated, by
referring to it in your program.