From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25025 invoked by alias); 5 Aug 2002 16:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24939 invoked by uid 71); 5 Aug 2002 16:36:01 -0000 Date: Mon, 05 Aug 2002 09:36:00 -0000 Message-ID: <20020805163601.24929.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Phil Edwards Subject: Re: c++/7498: copy constructor of ostream (and ios) is private and it should not be! Reply-To: Phil Edwards X-SW-Source: 2002-08/txt/msg00094.txt.bz2 List-Id: The following reply was made to PR c++/7498; it has been noted by GNATS. From: Phil Edwards To: mdp@fnal.gov Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/7498: copy constructor of ostream (and ios) is private and it should not be! Date: Mon, 5 Aug 2002 12:35:08 -0400 On Mon, Aug 05, 2002 at 04:22:39PM -0000, mdp@fnal.gov wrote: > The following program: > ----------------------------- > #include "iostream" > #include "fstream" > void main() { > ofstream file("test.dat"); > ostream a=file; > a << "Hello\n"; > file.close(); > } > ----------------------------- > > works on Visual C++ Visual C++ is broken. > but on g++ > gives the following error: Because the code is invalid. > Copy constructors of base_ios and derived classes should be public. No they shouldn't. See section 27.4 of the C++ standard. -- If ye love wealth greater than liberty, the tranquility of servitude greater than the animating contest for freedom, go home and leave us in peace. We seek not your counsel, nor your arms. Crouch down and lick the hand that feeds you; and may posterity forget that ye were our countrymen. - Samuel Adams