Article View: gnu.g++.bug
Article #1940virtual default args problem
From: 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
Technical Details
Message-ID:
<8905032057.AA13021@AENEAS.MIT.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.UCL.AC.UK!T.DayShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.UCL.AC.UK!T.Day From: T.Day@CS.UCL.AC.UK (Tim Day) Newsgroups: gnu.g++.bug Subject: virtual default args problem Message-ID: <8905032057.AA13021@AENEAS.MIT.EDU> Date: 3 May 89 20:50:45 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 37