Path: utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!PARIS.ICS.UCI.EDU!schmidt%crimee.ics.uci.edu From: schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") Newsgroups: gnu.g++.bug Subject: protection error with g++ 1.32 Message-ID: <8901021714.aa10397@PARIS.ICS.UCI.EDU> Date: 3 Jan 89 01:14:07 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 41 Hi, The following short C++ program demonstrates a problem with g++ 1.32's handling of private constructors in derived types: ---------------------------------------- class Base { public: char *Protex; Base ( char *s ) { Protex = s; } }; class Derived : public Base { Derived ( Base &b ) : ( b ) { printf ( "error: this is a private constructor!\n" ); } }; int main ( int argc, char *argv [ ] ) { Base B ( argv [ 0 ] ); Derived D ( B ); // this is an improper use of a private constructor } ---------------------------------------- The variable definition and initialization for Derived D ( B ); makes an illicit call to a private constructor. G++ 1.32 does not complain about this. AT&T cfront 1.2.1 correctly reports: ---------------------------------------- "bug.c", line 18: error: Derived::Derived() is private ---------------------------------------- more to come....! Doug