This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
varobj/2073: subscript operator on typedef'ed reference fails
- From: schaudhu at blackrock dot com
- To: gdb-gnats at sources dot redhat dot com
- Cc: bgmackay at blackrock dot com
- Date: 23 Jan 2006 23:53:09 -0000
- Subject: varobj/2073: subscript operator on typedef'ed reference fails
- Reply-to: schaudhu at blackrock dot com
>Number: 2073
>Category: varobj
>Synopsis: subscript operator on typedef'ed reference fails
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Jan 23 23:58:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: schaudhu@blackrock.com
>Release: unknown-1.0
>Organization:
>Environment:
SunOS 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Fire-V210, gcc-3.4.4/4.0.0, gdb-6.4
>Description:
Attempting to display the results of a subscript operator call on a reference that has been typedef'ed displays the error "cannot subscript something of type CLASSNAME". This is 100% reproducible in the environments specified. Using either -gdb and -gstabs+ flags makes no difference.
>How-To-Repeat:
The following code demonstrates the error:
#include <iostream>
class Foo
{
private:
int value;
public:
Foo( const int val ) { value = val; }
int operator[]( const int i ) const { return value; }
};
typedef Foo Bar;
int main()
{
Foo foo1( 123 );
std::cout << foo1[ 0 ] << std::endl;
// In the debugger, type print foo1[ 0 ]: NO PROBLEM
Foo &foo2 = foo1;
std::cout << foo2[ 0 ] << std::endl;
// In the debugger, type print foo2[ 0 ]: NO PROBLEM
Bar &bar1 = foo1;
std::cout << bar1[ 0 ] << std::endl;
// In the debugger, type print bar1[ 0 ]: ERROR!
// cannot subscript something of type `Foo'
Bar bar2( 321 );
std::cout << bar2[ 0 ] << std::endl;
// In the debugger, type print bar2[ 0 ]: NO PROBLEM
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: