[gnu.g++.bug] initialization of public base class w/ derived class.

lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) (09/19/89)

The following illustrates what I believe is a bug.  It seems to me that
in the line 'X b = a;', 'a' should be implicitly converted to an 'X', 
which should then initialize 'b'.


Script started on Mon Sep 18 14:45:46 1989

robbie(1)->cat a.cc

class X {
protected:
   int i;
};

class XX : public X {};

main(void)
{
   XX a;

   X b = a;
}

robbie(2)->g++ -v a.cc

g++ version 1.36.0-
 /usr/local/lib/gcc-cpp -+ -v -I/usr/local/include/g++-include -undef -D__GNU__ -D__GNUG__ -D__GNUC__ -D__cplusplus -Dunix -Di386 -Dsun386 -Dsun -D__unix__ -D__i386__ -D__sun386__ -D__sun__ a.cc /tmp/cca02845.cpp
GNU CPP version 1.35.96
 /usr/local/lib/gcc-cc1plus /tmp/cca02845.cpp -quiet -dumpbase a.cc -noreg -version -o /tmp/cca02845.s
GNU C++ version 1.36.0- (80386, Sun syntax) compiled by GNU C version 1.35.96.
default target switches: -m80387
a.cc: In function int main ():
a.cc:14: invalid initializer

robbie(3)->exit

script done on Mon Sep 18 14:46:32 1989

-- 
Mike Lijewski  (H)607/277-7623 (W)607/255-0539 (desk)607/255-2960
Cornell National Supercomputer Facility
ARPA: mjlx@cornellf.tn.cornell.edu  BITNET: mjlx@cornellf.bitnet
SMAIL:  1122 Ellis Hollow Rd. Ithaca, NY  14850