Thread View: gnu.g++.bug
2 messages
2 total messages
Started by Mike Bolotski
Fri, 01 Dec 1989 03:20
Inherited constructors
Author: Mike Bolotski
Date: Fri, 01 Dec 1989 03:20
Date: Fri, 01 Dec 1989 03:20
55 lines
2020 bytes
2020 bytes
I don't know whether this is a g++ bug or a 2.0 feature again, as I
don't have access to cfront. The Lippman book seems to allow the
behaviour, and g++ 1.35 allowed it too. How else should an interited
constructor be used?
-----------
Script started on Thu Nov 30 20:05:23 1989
coho{mikeb}71: g++ -v rho.cc
g++ version 1.36.2- (based on GCC 1.36)
/usr/local/lib/gnu/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 rho.cc /usr/tmp/cca27339.cpp
GNU CPP version 1.36
/usr/local/lib/gnu/gcc-cc1plus /usr/tmp/cca27339.cpp -quiet -dumpbase rho.cc -version -o /usr/tmp/cca27339.s
GNU C++ version 1.36.2- (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
rho.cc: In method Beta::Beta (const class Beta &):
rho.cc:24: type `Beta' is derived from private `Alpha'
coho{mikeb}72: cat rho.cc
class Alpha
{
int x;
public:
Alpha(const Alpha&);
Alpha(int );
};
class Beta : private Alpha
{
char y;
public:
Beta(const Beta&);
Beta(char );
};
inline Beta::Beta(const Beta& b) : Alpha(b), y('z') {}
int main()
{
}
script done on Thu Nov 30 20:08:27 1989
--
Mike Bolotski, Department of Electrical Engineering,
University of British Columbia, Vancouver, Canada
mikeb@salmon.ee.ubc.ca | mikeb%ee.ubc.ca@relay.ubc.ca
ee.ubc.ca!mikeb@uunet.uu.net | uunet!ubc-cs!ee.ubc.ca!mikeb
Re: Inherited constructors
Author: Doug Schmidt
Date: Fri, 01 Dec 1989 06:02
Date: Fri, 01 Dec 1989 06:02
18 lines
1339 bytes
1339 bytes
In article <8912010420.AA27527@salmon.ee.ubc.ca>, mikeb@SALMON (Mike Bolotski) writes:
>
>I don't know whether this is a g++ bug or a 2.0 feature again, as I
>don't have access to cfront. The Lippman book seems to allow the
>behaviour, and g++ 1.35 allowed it too. How else should an interited
>constructor be used?
This is a known bug with 1.36.2-. As a workaround, try casting
the base initialization of Alpha, e.g.,
inline Beta::Beta(const Beta& b) : Alpha((Alpha &)b), y('z') {}
Doug
--
Any man's death diminishes me, | schmidt@ics.uci.edu (ARPA)
Because I am involved in Mankind; | office: (714) 856-4043
And therefore never send to know for whom the bell tolls;
It tolls for thee -- John Donne
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