std::ios::copyfmt() doesn't copy tie(), getloc()
------------------------------------------------
Key: STDCXX-766
URL: https://issues.apache.org/jira/browse/STDCXX-766
Project: C++ Standard Library
Issue Type: Bug
Components: 27. Input/Output
Affects Versions: 4.2.0, 4.1.4, 4.1.3, 4.1.2
Environment: all
Reporter: Martin Sebor
Fix For: 4.2.1
The following test fails with the latest trunk.
{noformat}
$ cat t.cpp && make t && ./t
#include <cstdio>
#include <ios>
#include <iosfwd>
#include <locale>
#include <ostream>
#define ASSERT(expr) \
(expr) ? (void)0 \
: (void)std::fprintf (stderr, "line %d: Assertion failed: %s\n", \
__LINE__, #expr)
int main ()
{
std::ios x ((std::streambuf*)1);
x.tie ((std::ostream*)2);
std::ios y (0);
const std::ios::iostate x_rdstate = x.rdstate ();
const std::streambuf* const x_rdbuf = x.rdbuf ();
const std::locale loc =
std::locale (std::locale::classic (), new std::numpunct<char>());
y.tie (x.tie () + 1);
y.exceptions (y.eofbit);
y.flags (y.boolalpha | y.scientific);
y.precision (x.precision () + 1);
y.width (x.width () + 1);
y.fill (x.fill () + 1);
y.imbue (loc);
ASSERT (x.tie () != y.tie ());
ASSERT (x.getloc () != y.getloc ());
x.copyfmt (y);
ASSERT (x.rdbuf () == x_rdbuf);
ASSERT (x.tie () == y.tie ());
ASSERT (x.rdstate () == x_rdstate);
ASSERT (x.exceptions () == y.exceptions ());
ASSERT (x.flags () == y.flags ());
ASSERT (x.precision () == y.precision ());
ASSERT (x.width () == y.width ());
ASSERT (x.fill () == y.fill ());
ASSERT (x.getloc () == y.getloc ());
}
gcc -c -I/home/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -I/home/sebor/stdcxx/i
nclude -I/build/sebor/stdcxx-gcc-4.1.2-11S-LVS/include -I/home/sebor/stdcxx/incl
ude/ansi -I/build/sebor/PlumHall/lvs07a/conform -I/build/sebor/PlumHall/lvs07a/d
st.3 -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-
strings -Wno-long-long -Wcast-align t.cpp
gcc t.o -o t -L/build/sebor/stdcxx-gcc-4.1.2-11S-LVS/lib -lstd11S -lsupc++ -lm
line 39: Assertion failed: x.tie () == y.tie ()
line 46: Assertion failed: x.getloc () == y.getloc ()
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.