public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/38365]  New: Locale, constructed from named and unnamed locales, become named
@ 2008-12-02  9:02 tsyvarev at ispras dot ru
  2008-12-02  9:55 ` [Bug libstdc++/38365] " paolo dot carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tsyvarev at ispras dot ru @ 2008-12-02  9:02 UTC (permalink / raw)
  To: gcc-bugs

Locale constructor

locale(const locale& other, const locale& one, locale::category cats)

creates named locale when 'other' - named locale, but 'one' - unnamed.

According to 22.1.1 p8:
A locale constructed from a name string (such as "POSIX"), or from parts of two
named locales, has a name; all others do not.

Example:
[test.cpp]
#include <locale>
#include <iostream>
using namespace std;

int main()
{
    locale other(locale("C"));
    locale one(locale("en_US"), new ctype<char>());
    locale loc(other, one, locale::collate);
    cout << "one.name() is " << one.name() << endl;
    cout << "other.name() is " << other.name() << endl;
    cout << "loc.name() is " << loc.name() << endl;
    return 0;
}

[tester@Fedore8 locale_name]$ g++ test.cpp && ./a.out
one.name() is *
other.name() is C
loc.name() is C
[tester@Fedore8 locale_name]$ g++ --version
g++ (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-- 
           Summary: Locale, constructed from named and unnamed locales,
                    become named
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tsyvarev at ispras dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
@ 2008-12-02  9:55 ` paolo dot carlini at oracle dot com
  2008-12-02 10:59 ` paolo at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-12-02  9:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2008-12-02 09:53 -------
Ok.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |paolo dot carlini at oracle
                   |dot org                     |dot com
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-02 09:53:15
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
  2008-12-02  9:55 ` [Bug libstdc++/38365] " paolo dot carlini at oracle dot com
@ 2008-12-02 10:59 ` paolo at gcc dot gnu dot org
  2008-12-02 11:01 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu dot org @ 2008-12-02 10:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo at gcc dot gnu dot org  2008-12-02 10:58 -------
Subject: Bug 38365

Author: paolo
Date: Tue Dec  2 10:57:22 2008
New Revision: 142349

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142349
Log:
2008-12-02  Paolo Carlini  <paolo.carlini@oracle.com>

        PR libstdc++/38365
        * src/localename.cc (locale::locale(const locale&, const locale&,
        category)): Fix.
        * testsuite/22_locale/locale/cons/38365.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/localename.cc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
  2008-12-02  9:55 ` [Bug libstdc++/38365] " paolo dot carlini at oracle dot com
  2008-12-02 10:59 ` paolo at gcc dot gnu dot org
@ 2008-12-02 11:01 ` paolo dot carlini at oracle dot com
  2008-12-02 13:06 ` tsyvarev at ispras dot ru
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-12-02 11:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2008-12-02 10:59 -------
Fixed for 4.4.0.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0
            Version|unknown                     |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
                   ` (2 preceding siblings ...)
  2008-12-02 11:01 ` paolo dot carlini at oracle dot com
@ 2008-12-02 13:06 ` tsyvarev at ispras dot ru
  2008-12-02 13:23 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tsyvarev at ispras dot ru @ 2008-12-02 13:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tsyvarev at ispras dot ru  2008-12-02 13:04 -------
According to the code, locale constructor calls

void locale::_Impl::_M_replace_categories(const _Impl* __imp, category __cat)

which already processes names of locales. This function works correctly, when
both locales (*this and __impl) have names, or when *this locale hasn't name.
But when *this locale has name, but __imp hasn't, the function doesn't clear
name of *this.

Your patch fixes the problem at the level of the locale constructor, but why do
not fix this problem at the level of  _M_replace_categories() instead? 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
                   ` (3 preceding siblings ...)
  2008-12-02 13:06 ` tsyvarev at ispras dot ru
@ 2008-12-02 13:23 ` paolo dot carlini at oracle dot com
  2008-12-02 13:35 ` paolo dot carlini at oracle dot com
  2008-12-02 15:05 ` paolo at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-12-02 13:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo dot carlini at oracle dot com  2008-12-02 13:21 -------
(In reply to comment #4)
> Your patch fixes the problem at the level of the locale constructor, but why do
> not fix this problem at the level of  _M_replace_categories() instead? 

Because that would not work, _M_impl has already a name ("C") by that time. 
Note that all these classes are suboptimal performance-wise, will be redesigned
for the next ABI.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
                   ` (4 preceding siblings ...)
  2008-12-02 13:23 ` paolo dot carlini at oracle dot com
@ 2008-12-02 13:35 ` paolo dot carlini at oracle dot com
  2008-12-02 15:05 ` paolo at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-12-02 13:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from paolo dot carlini at oracle dot com  2008-12-02 13:34 -------
(In reply to comment #5)
> (In reply to comment #4)
> > Your patch fixes the problem at the level of the locale constructor, but why do
> > not fix this problem at the level of  _M_replace_categories() instead? 
> 
> Because that would not work, _M_impl has already a name ("C") by that time.

Sorry, now I see that the involved _Impl constructor clones, thus creates an
unnamed clone if the original one is unnamed, thus the idea can work.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/38365] Locale, constructed from named and unnamed locales, become named
  2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
                   ` (5 preceding siblings ...)
  2008-12-02 13:35 ` paolo dot carlini at oracle dot com
@ 2008-12-02 15:05 ` paolo at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu dot org @ 2008-12-02 15:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from paolo at gcc dot gnu dot org  2008-12-02 15:04 -------
Subject: Bug 38365

Author: paolo
Date: Tue Dec  2 15:02:53 2008
New Revision: 142358

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142358
Log:
2008-12-02  Paolo Carlini  <paolo.carlini@oracle.com>

        PR libstdc++/38365 (cont)
        * src/localename.cc (locale::locale(const locale&, const locale&,
        category)): Revert last changes.
        * src/localename.cc (locale::_Impl::_M_replace_categories(const
        _Impl*, category)): Fix here instead; rework.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/localename.cc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38365


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-12-02 15:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-02  9:02 [Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named tsyvarev at ispras dot ru
2008-12-02  9:55 ` [Bug libstdc++/38365] " paolo dot carlini at oracle dot com
2008-12-02 10:59 ` paolo at gcc dot gnu dot org
2008-12-02 11:01 ` paolo dot carlini at oracle dot com
2008-12-02 13:06 ` tsyvarev at ispras dot ru
2008-12-02 13:23 ` paolo dot carlini at oracle dot com
2008-12-02 13:35 ` paolo dot carlini at oracle dot com
2008-12-02 15:05 ` paolo at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).