This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7359: Global FIle Streams Broken
- From: cda at freshsources dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 19 Jul 2002 16:18:08 -0000
- Subject: c++/7359: Global FIle Streams Broken
- Reply-to: cda at freshsources dot com
>Number: 7359
>Category: c++
>Synopsis: Global FIle Streams Broken
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 19 09:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Chuck Allison
>Release: 3.1 and 3.1.1
>Organization:
>Environment:
Cygwin/Windows XP
Cygwin/Windows 2000
>Description:
Global file streams don't compile. Here's the code:
#include <iostream>
#include <fstream>
using namespace std;
ofstream out("trace.out");
int main() {
out << "A test line\n";
out << "one more" << endl;
}
It works on Microsoft VC .NET, but g++ chokes. The error output for 3.1 is in the file attachment. A friend tried it on 3.1.1-3 and it also failed. According to the standard, it should work (although I realize library initialization is tricky - but if MS can do it, anyone can, right? :-). I passed this by Bjarne Stroustrup and a couple other standards committee members just to double check and they all agree it is conforming code. Thanks.
>How-To-Repeat:
Attempt to compile the code in the description field above.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: