Article View: gnu.g++.bug
Article #1950Re: virtual default args problem
From: Gordon Joly
Date: Fri, 05 May 1989 12:47
Date: Fri, 05 May 1989 12:47
53 lines
2070 bytes
2070 bytes
Tim,
Is this fixed in 1.35.0- ?
Gordon.
karl:/stats/staff/karl/gordon/c++[60] make scoobie
g++ -g -lg++ -lm scoobie.cc -o scoobie
scoobie.cc:13: sorry, not implemented: that operation not supported for default parameters
g++: Program c++ got fatal signal 6.
make: *** Error 1
karl:/stats/staff/karl/gordon/c++[61] g++ -v
g++ version 1.35.0-
karl:/stats/staff/karl/gordon/c++[62] date
Fri May 5 13:44:03 BST 1989
karl:/stats/staff/karl/gordon/c++[63] cat -n scoobie.cc
1 //The below example gives a 'Program c++ got fatal signal 6.' under
2 // g++ version 1.34.2.
3 // ---------
4 #include <String.h>
5
6 String blurb("bleah");
7
8 class Foo
9 { String a;
10 public:
11 Foo() {}
12 virtual void scooby(String s=blurb) {a=s;}
13 virtual void doobie(String s=String("bleaurgh")) {a=s;}
14 };
15
16 class Bar : public Foo
17 { String b;
18 public:
19 Bar() {}
20 virtual void scooby(String s=blurb) {b=s;}
21 virtual void doobie(String s=String("bleaurgh")) {b=s;}
22 // Above line causes problem
23 };
24
25 main()
26 { Foo x;
27 Bar y;
28
29 exit(0);
30 }
31 // ----------
32 // Commenting out the 'doobie' member function of 'Bar' eliminates this.
33 // I'm not sure if this sort of default arg. should be allowed anyway since
34 // the two 'String("bleaurgh")'s are effectively different things, but obviously
35 // an error message of some sort is preferable
36 //
37 // Tim
38
karl:/stats/staff/karl/gordon/c++[64]
Technical Details
Message-ID:
<8905051341.AA17671@AENEAS.MIT.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!NSFNET-RELAY.AC.UK!gordon%stats.ucl.ac.ukShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!NSFNET-RELAY.AC.UK!gordon%stats.ucl.ac.uk From: gordon%stats.ucl.ac.uk@NSFNET-RELAY.AC.UK (Gordon Joly) Newsgroups: gnu.g++.bug Subject: Re: virtual default args problem Message-ID: <8905051341.AA17671@AENEAS.MIT.EDU> Date: 5 May 89 12:47:16 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 53