mikeb@SALMON.EE.UBC.CA (Mike Bolotski) (12/01/89)
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!mikebschmidt@glacier.ics.uci.edu (Doug Schmidt) (12/01/89)
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