schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/03/89)
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