Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Ned Nowotny
Fri, 01 Dec 1989 22:13
Bug Report
Author: Ned Nowotny
Date: Fri, 01 Dec 1989 22:13
Date: Fri, 01 Dec 1989 22:13
70 lines
2382 bytes
2382 bytes
Two bugs in g++:
1. If a derived class is accidently (and incorrectly, of course) declared
more than once and the base class from which the multiply declared
class is derived contains a virtual function, the compile will eventually
dump core with a segmentation violation. It appears that the combination
of a virtual function in the base class with the multiple declaration is
significant. The following code still printed the correct error messages,
but did not dump core when the "virtual" keyword was removed.
2. Hardly worth noting: g++ -v prints "gcc version ... (based on GCC ...)".
It seems that "g++ version ... (based on GCC ...)" is intended.
Script started on Fri Dec 1 14:57:27 1989
$ cat /etc/motd ; mach ; arch
SunOS Release 4.0.3 (GENERIC) #2: Mon Apr 24 16:53:06 PDT 1989
sparc
sun4
$ /net/maverick/usr/local/gnu/bin/g++ -v
gcc version 1.36.1 (based on GCC 1.36)
$ cat test.c
/* test.c */
#include <stream.h>
class a
{
public:
a() { cout << "I think I will be an a.\n"; }
virtual void Print();
};
class b : a
{
public:
b() { cout << "I think I will be a b.\n"; }
void Print();
};
class b : a
{
public:
b() { cout << "I think I will be a b.\n"; }
//void Print();
};
void a::Print()
{
cout << "I think I am an a.\n";
}
void b::Print()
{
cout << "I must be a b.\n";
}
$ g++ -c test.c
test.c:20: redeclaration of derivation chain of type `b'
test.c:24: redefinition of `struct b'
test.c:36: Segmentation violation
g++: Program cc1plus got fatal signal 11.
$ exit
script done on Fri Dec 1 14:58:37 1989
Ned Nowotny, MCC CAD Program, Box 200195, Austin, TX 78720 Ph: (512) 338-3715
ARPA: ned@mcc.com UUCP: ...!cs.utexas.edu!milano!cadillac!ned
-------------------------------------------------------------------------------
"We have ways to make you scream." - Intel advertisement in the June 1989 DDJ.
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