You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/03/20 00:00:28 UTC

[jira] Resolved: (STDCXX-766) std::ios::copyfmt() doesn't copy tie(), getloc()

     [ https://issues.apache.org/jira/browse/STDCXX-766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor resolved STDCXX-766.
---------------------------------

    Resolution: Fixed

Fix committed in [r639048|http://svn.apache.org/viewvc?rev=639048&view=rev].
Regression test in [r639050|http://svn.apache.org/viewvc?rev=639050&view=rev].
Will close after nightly testing and merging into 4.2.x.

> 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.1.2, 4.1.3, 4.1.4, 4.2.0
>         Environment: all
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>             Fix For: 4.2.1
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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.