Article View: gnu.g++.bug
Article #1592protection error with g++ 1.32
From: "Douglas C. Schmidt"
Date: Tue, 03 Jan 1989 01:14
Date: Tue, 03 Jan 1989 01:14
41 lines
1432 bytes
1432 bytes
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
Technical Details
Message-ID:
<8901021714.aa10397@PARIS.ICS.UCI.EDU>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!PARIS.ICS.UCI.EDU!schmidt%crimee.ics.uci.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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