public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/2416: casting to reference type causes internal error
@ 2008-04-01 17:31 aristovski
0 siblings, 0 replies; 2+ messages in thread
From: aristovski @ 2008-04-01 17:31 UTC (permalink / raw)
To: aristovski, gdb-prs, nobody
Synopsis: casting to reference type causes internal error
State-Changed-From-To: open->closed
State-Changed-By: aristovski
State-Changed-When: Tue Apr 1 17:31:04 2008
State-Changed-Why:
Fixed.
http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2416
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/2416: casting to reference type causes internal error
@ 2008-02-27 17:58 aristovski
0 siblings, 0 replies; 2+ messages in thread
From: aristovski @ 2008-02-27 17:58 UTC (permalink / raw)
To: gdb-gnats
>Number: 2416
>Category: c++
>Synopsis: casting to reference type causes internal error
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 27 17:58:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: aristovski@qnx.com
>Release: 6.7
>Organization:
>Environment:
linux
>Description:
When casting to a reference type, gdb_assert is triggered causing internal error.
>How-To-Repeat:
Use the following to create files main.cc and init
=== main.cc ===
#include <cstdlib>
#include <iostream>
using namespace std;
namespace IP {
class base {
public:
base () {
cout << "Base class\n";
}
virtual void foo() {}
};
class derived: public base {
public:
derived () {
cout << "Derived class\n";
derivedfield = 42;
}
void foo() {
cout << "derived::foo" << endl;
}
int derivedfield;
};
}
void testCast1 (IP::base & arg) {
cout << "Test the casting\n";
arg.foo();
}
void testCast2 (IP::base (&arr)[2])
{
arr[0].foo();
arr[1].foo();
}
void testCast3 (IP::base *(&arr)[2])
{
arr[0]->foo();
arr[1]->foo();
}
int main(int argc, char *argv[]) {
IP::base a[] = { IP::derived(), IP::base() };
IP::base *d = new IP::derived();
IP::base * basder[] = { new IP::derived(), new IP::base() };
testCast1(*d);
testCast2(a);
testCast3(basder);
return 1;
}
================
=== file init ===
file main
b testCast1
b testCast2
b testCast3
r
print ('IP::derived' &) arg
echo "I'm still alive..."
c
=================
now compile main.cc:
g++ -g -o main main.cc
Finally, run
gdb -x init
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-01 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-01 17:31 c++/2416: casting to reference type causes internal error aristovski
-- strict thread matches above, loose matches on Subject: below --
2008-02-27 17:58 aristovski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).