Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Tim Day
Wed, 03 May 1989 20:50
virtual default args problem
Author: Tim Day
Date: Wed, 03 May 1989 20:50
Date: Wed, 03 May 1989 20:50
37 lines
1209 bytes
1209 bytes
The below example gives a 'Program c++ got fatal signal 6.' under
g++ version 1.34.2.
---------
#include <String.h>
String blurb("bleah");
class Foo
{ String a;
public:
Foo() {}
virtual void scooby(String s=blurb) {a=s;}
virtual void doobie(String s=String("bleaurgh")) {a=s;}
};
class Bar : public Foo
{ String b;
public:
Bar() {}
virtual void scooby(String s=blurb) {b=s;}
virtual void doobie(String s=String("bleaurgh")) {b=s;}
// Above line causes problem
};
main()
{ Foo x;
Bar y;
exit(0);
}
----------
Commenting out the 'doobie' member function of 'Bar' eliminates this.
I'm not sure if this sort of default arg. should be allowed anyway since
the two 'String("bleaurgh")'s are effectively different things, but obviously
an error message of some sort is preferable
Tim
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