Thread View: gnu.gdb.bug
1 messages
1 total messages
Started by John Hagerman
Sat, 03 Jun 1989 18:40
Applying Member Functions
Author: John Hagerman
Date: Sat, 03 Jun 1989 18:40
Date: Sat, 03 Jun 1989 18:40
40 lines
1188 bytes
1188 bytes
This is on a VAXstation 3200 running BSD 4.3, using g++ version 1.35.0
and GDB 3.1.2.
Consider the following C++ program:
#include <stream.h>
class Simple
{
int i;
public:
Simple(int i_init) { i = i_init; }
int GetI() { return i; }
}
main()
{
Simple s_real(5);
Simple &s_ref = s_real;
cout << s_real.GetI() << "\n";
cout << s_ref.GetI() << "\n";
exit(0);
}
When compiled and run, it produces two 5's as expected. When in GDB,
however, applying the member function works for the object but not for
the object reference:
...
Bpt 1, main (1, 2147477544, 2147477552) (gdb-bug.C line 14)
(gdb) n
(gdb) print s_real.GetI()
$1 = 5
(gdb) print s_ref.GetI()
$2 = 2147477444
(gdb)
- John
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads