This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9215: Problem with reserting a stream to default using setf
- From: jon dot gjerde at nr dot no
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Jan 2003 09:51:27 -0000
- Subject: c++/9215: Problem with reserting a stream to default using setf
- Reply-to: jon dot gjerde at nr dot no
>Number: 9215
>Category: c++
>Synopsis: Problem with reserting a stream to default using setf
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Jan 07 01:56:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Jon Gjerde
>Release: gcc version 3.1.1
>Organization:
>Environment:
SunOS lyra 5.8 Generic_108528-12 sun4u sparc SUNW,Sun-Fire-280R
/local/gcc3.1.1/bin/g++ -v
Reading specs from /local/gcc3.1.1/lib/gcc-lib/sparc-sun-solaris2.8/3.1.1/specs
Configured with: ./configure --prefix=/local/gcc3.1.1
Thread model: posix
>Description:
stream.C: In function `int main()':
stream.C:15: invalid conversion from `int' to `std::_Ios_Fmtflags'
stream.C:15: initializing argument 1 of `std::_Ios_Fmtflags
std::ios_base::setf(std::_Ios_Fmtflags, std::_Ios_Fmtflags)'
>How-To-Repeat:
Compile the following:
--- Begin Source ---
#include <iostream>
#include <fstream>
using std::cout;
using std::endl;
using std::ios_base;
int main()
{
double a = 1234.56789;
cout << a << endl;
cout.setf(ios_base::scientific, ios_base::floatfield);
cout << a << endl;
cout.setf(0, ios_base::floatfield); // Return to default output
cout << a << endl;
}
--- End source ---
>Fix:
Use the cc: Sun WorkShop 6 update 1 compiler :-)
>Release-Note:
>Audit-Trail:
>Unformatted: