You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/12/09 01:39:20 UTC

[jira] Created: (STDCXX-307) std::streambuf::imbue() stores locale when it shouldn't

std::streambuf::imbue() stores locale when it shouldn't
-------------------------------------------------------

                 Key: STDCXX-307
                 URL: http://issues.apache.org/jira/browse/STDCXX-307
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 27. Input/Output
         Environment: all
            Reporter: Martin Sebor


According to 27.5.2.4.1 [streambuf.virt.locales], p3, the default behavior of std::streambuf::imbue() is to do nothing. The program below detects
whether the function stores the locale passed to it (it's not expected to). When compiled against the latest trunk the program abots at runtime
indicating that the function does, in fact, store the locale, contrary to the requirement.

$ cat z.cpp && make z && ./z
#include <cassert>
#include <locale>
#include <streambuf>

struct MyFacet: std::locale::facet { static std::locale::id id; };
std::locale::id MyFacet::id;

int main ()
{
    struct MyBuf: std::streambuf {
        void imbue (const std::locale &loc) {
            std::streambuf::imbue (loc);
        }
    } buf;

    const std::locale loc (buf.getloc (), new MyFacet);

    assert (std::has_facet<MyFacet>(loc));
    assert (!std::has_facet<MyFacet>(buf.getloc ()));

    buf.imbue (loc);

    assert (!std::has_facet<MyFacet>(buf.getloc ()));
}
gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   z.cpp
gcc z.o -o z  -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s  -lsupc++ -lm 
Assertion failed: !std::has_facet<MyFacet>(buf.getloc ()), file z.cpp, line 23
Abort (core dumped)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (STDCXX-307) std::streambuf::imbue() stores locale when it shouldn't

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov resolved STDCXX-307.
----------------------------------

    Resolution: Fixed

Fixed thus: http://svn.apache.org/viewvc?rev=597665&view=rev

Regression test added thus: http://svn.apache.org/viewvc?rev=597668&view=rev

> std::streambuf::imbue() stores locale when it shouldn't
> -------------------------------------------------------
>
>                 Key: STDCXX-307
>                 URL: https://issues.apache.org/jira/browse/STDCXX-307
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.2, 4.1.3
>         Environment: all
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>             Fix For: 4.2.1
>
>
> According to 27.5.2.4.1 [streambuf.virt.locales], p3, the default behavior of std::streambuf::imbue() is to do nothing. The program below detects
> whether the function stores the locale passed to it (it's not expected to). When compiled against the latest trunk the program abots at runtime
> indicating that the function does, in fact, store the locale, contrary to the requirement.
> $ cat z.cpp && make z && ./z
> #include <cassert>
> #include <locale>
> #include <streambuf>
> struct MyFacet: std::locale::facet { static std::locale::id id; };
> std::locale::id MyFacet::id;
> int main ()
> {
>     struct MyBuf: std::streambuf {
>         void imbue (const std::locale &loc) {
>             std::streambuf::imbue (loc);
>         }
>     } buf;
>     const std::locale loc (buf.getloc (), new MyFacet);
>     assert (std::has_facet<MyFacet>(loc));
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
>     buf.imbue (loc);
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
> }
> gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   z.cpp
> gcc z.o -o z  -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s  -lsupc++ -lm 
> Assertion failed: !std::has_facet<MyFacet>(buf.getloc ()), file z.cpp, line 23
> Abort (core dumped)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STDCXX-307) std::streambuf::imbue() stores locale when it shouldn't

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov reassigned STDCXX-307:
------------------------------------

    Assignee: Farid Zaripov

> std::streambuf::imbue() stores locale when it shouldn't
> -------------------------------------------------------
>
>                 Key: STDCXX-307
>                 URL: https://issues.apache.org/jira/browse/STDCXX-307
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.2, 4.1.3
>         Environment: all
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>             Fix For: 4.2.1
>
>
> According to 27.5.2.4.1 [streambuf.virt.locales], p3, the default behavior of std::streambuf::imbue() is to do nothing. The program below detects
> whether the function stores the locale passed to it (it's not expected to). When compiled against the latest trunk the program abots at runtime
> indicating that the function does, in fact, store the locale, contrary to the requirement.
> $ cat z.cpp && make z && ./z
> #include <cassert>
> #include <locale>
> #include <streambuf>
> struct MyFacet: std::locale::facet { static std::locale::id id; };
> std::locale::id MyFacet::id;
> int main ()
> {
>     struct MyBuf: std::streambuf {
>         void imbue (const std::locale &loc) {
>             std::streambuf::imbue (loc);
>         }
>     } buf;
>     const std::locale loc (buf.getloc (), new MyFacet);
>     assert (std::has_facet<MyFacet>(loc));
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
>     buf.imbue (loc);
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
> }
> gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   z.cpp
> gcc z.o -o z  -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s  -lsupc++ -lm 
> Assertion failed: !std::has_facet<MyFacet>(buf.getloc ()), file z.cpp, line 23
> Abort (core dumped)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STDCXX-307) std::streambuf::imbue() stores locale when it shouldn't

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-307:
--------------------------------

    Fix Version/s: 4.2.1

Scheduled for 4.2.1.

> std::streambuf::imbue() stores locale when it shouldn't
> -------------------------------------------------------
>
>                 Key: STDCXX-307
>                 URL: https://issues.apache.org/jira/browse/STDCXX-307
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.2, 4.1.3
>         Environment: all
>            Reporter: Martin Sebor
>             Fix For: 4.2.1
>
>
> According to 27.5.2.4.1 [streambuf.virt.locales], p3, the default behavior of std::streambuf::imbue() is to do nothing. The program below detects
> whether the function stores the locale passed to it (it's not expected to). When compiled against the latest trunk the program abots at runtime
> indicating that the function does, in fact, store the locale, contrary to the requirement.
> $ cat z.cpp && make z && ./z
> #include <cassert>
> #include <locale>
> #include <streambuf>
> struct MyFacet: std::locale::facet { static std::locale::id id; };
> std::locale::id MyFacet::id;
> int main ()
> {
>     struct MyBuf: std::streambuf {
>         void imbue (const std::locale &loc) {
>             std::streambuf::imbue (loc);
>         }
>     } buf;
>     const std::locale loc (buf.getloc (), new MyFacet);
>     assert (std::has_facet<MyFacet>(loc));
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
>     buf.imbue (loc);
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
> }
> gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   z.cpp
> gcc z.o -o z  -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s  -lsupc++ -lm 
> Assertion failed: !std::has_facet<MyFacet>(buf.getloc ()), file z.cpp, line 23
> Abort (core dumped)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STDCXX-307) std::streambuf::imbue() stores locale when it shouldn't

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-307:
--------------------------------

    Affects Version/s: 4.1.3
                       4.1.2

> std::streambuf::imbue() stores locale when it shouldn't
> -------------------------------------------------------
>
>                 Key: STDCXX-307
>                 URL: https://issues.apache.org/jira/browse/STDCXX-307
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: all
>            Reporter: Martin Sebor
>
> According to 27.5.2.4.1 [streambuf.virt.locales], p3, the default behavior of std::streambuf::imbue() is to do nothing. The program below detects
> whether the function stores the locale passed to it (it's not expected to). When compiled against the latest trunk the program abots at runtime
> indicating that the function does, in fact, store the locale, contrary to the requirement.
> $ cat z.cpp && make z && ./z
> #include <cassert>
> #include <locale>
> #include <streambuf>
> struct MyFacet: std::locale::facet { static std::locale::id id; };
> std::locale::id MyFacet::id;
> int main ()
> {
>     struct MyBuf: std::streambuf {
>         void imbue (const std::locale &loc) {
>             std::streambuf::imbue (loc);
>         }
>     } buf;
>     const std::locale loc (buf.getloc (), new MyFacet);
>     assert (std::has_facet<MyFacet>(loc));
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
>     buf.imbue (loc);
>     assert (!std::has_facet<MyFacet>(buf.getloc ()));
> }
> gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   z.cpp
> gcc z.o -o z  -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s  -lsupc++ -lm 
> Assertion failed: !std::has_facet<MyFacet>(buf.getloc ()), file z.cpp, line 23
> Abort (core dumped)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.