c++/7498: copy constructor of ostream (and ios) is private and it should not be!
mdp@fnal.gov
mdp@fnal.gov
Mon Aug 5 09:26:00 GMT 2002
>Number: 7498
>Category: c++
>Synopsis: copy constructor of ostream (and ios) is private and it should not be!
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 05 09:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Massimo Di Pierro
>Release: gcc 2.96.3 20000503/Linux
>Organization:
>Environment:
Fermi Linux (www.fnal.gov) based on Red Hat 6.x.
>Description:
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++ but on g++
gives the following error:
-----------------------------
test.cpp: In method `ostream::ostream(int, int (***)(...), const ostream &)':
/usr/lib/gcc-lib/i386-redhat-linux/2.95.3/../../../../include/g++-3/streambuf.h:128: `ios::ios(const ios &)' is private
test.cpp:5: within this context
-----------------------------
>How-To-Repeat:
>Fix:
Copy constructors of base_ios and derived classes should be public.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list