stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (STDCXX-478) std::locale::operator==() inconsistent for locales with the same user-defined facets
Date Mon, 09 Jul 2007 04:49:05 GMT

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

Martin Sebor resolved STDCXX-478.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2

Resolved. Will close after a regression test has been added to the test suite.

> std::locale::operator==() inconsistent for locales with the same user-defined facets
> ------------------------------------------------------------------------------------
>
>                 Key: STDCXX-478
>                 URL: https://issues.apache.org/jira/browse/STDCXX-478
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.1.3, 4.1.2
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> The program below is intended to take advantage of the stdcxx extension whereby two unnamed
locales compare equal when they represent the exact same object (i.e., when all their facets
are exactly same). The program passes the first assertion but aborts in the second one:
> $ cat t.cpp && make t && ./t
> #include <cassert>
> #include <cstdio>
> #include <locale>
> struct A: std::num_put<char, char*> { A (): std::num_put<char, char*>(1)
{ } };
> struct B: std::num_put<char, char*> { B (): std::num_put<char, char*>(1)
{ } };
> int main ()
> {
>     const std::locale en ("en_US");
>     const A* const a = new A;
>     const B* const b = new B;
>     {
>         const std::locale usr1 (std::locale (en, a), b);
>         const std::locale usr2 (std::locale (en, a), b);
>         std::printf ("\"%s\" == \"%s\"\n",
>                      usr1.name ().c_str (), usr2.name ().c_str ());
>        assert (usr1 == usr2);
>     }
>     {
>         const std::locale usr1 (std::locale (en, a), b);
>         const std::locale usr2 (std::locale (en, b), a);
>         std::printf ("\"%s\" == \"%s\"\n",
>                      usr1.name ().c_str (), usr2.name ().c_str ());
>        assert (usr1 == usr2);
>     }
> }
> icc -c -I/home/sebor/stdcxx/include/ansi -D_RWSTDDEBUG   -D_REENTRANT -I/home/sebor/stdcxx/include
-I/build/sebor/stdcxx-icc-10.0.025-15S/include -I/home/sebor/stdcxx/examples/include  -cxxlib-nostd
-g   -w1   t.cpp
> icc t.o -o t -cxxlib-nostd  -lpthread  -L/build/sebor/stdcxx-icc-10.0.025-15S/lib  -lstd15S
-lcxaguard -lsupc++ -lm 
> "*" == "*"
> "*" == "*"
> t: t.cpp:32: int main(): Assertion `usr1 == usr2' failed.
> Aborted

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


Mime
View raw message