This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7498: copy constructor of ostream (and ios) is private and it should not be!
- From: Phil Edwards <phil at jaj dot com>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 5 Aug 2002 16:36:01 -0000
- Subject: Re: c++/7498: copy constructor of ostream (and ios) is private and it should not be!
- Reply-to: Phil Edwards <phil at jaj dot com>
The following reply was made to PR c++/7498; it has been noted by GNATS.
From: Phil Edwards <phil@jaj.com>
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