re PR libstdc++/38365 (Locale, constructed from named and unnamed locales, become named)
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. From-SVN: r142349
This commit is contained in:
parent
0d2a6e08da
commit
95e5f0ce00
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
||||
2008-12-01 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
PR libstdc++/38080
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
// 2006, 2007
|
||||
// 2006, 2007, 2008
|
||||
// Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
@ -157,7 +157,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
locale::locale(const locale& __base, const locale& __add, category __cat)
|
||||
: _M_impl(0)
|
||||
{ _M_coalesce(__base, __add, __cat); }
|
||||
{
|
||||
_M_coalesce(__base, __add, __cat);
|
||||
if (!__base._M_impl->_M_names[0] || !__add._M_impl->_M_names[0])
|
||||
{
|
||||
delete [] _M_impl->_M_names[0];
|
||||
_M_impl->_M_names[0] = 0; // Unnamed.
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
locale::_M_coalesce(const locale& __base, const locale& __add,
|
||||
|
45
libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
Normal file
45
libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
Normal file
@ -0,0 +1,45 @@
|
||||
// { dg-require-namedlocale "" }
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
// USA.
|
||||
|
||||
// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
|
||||
|
||||
#include <locale>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// libstdc++/38365
|
||||
void test01()
|
||||
{
|
||||
using namespace std;
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
locale other(locale("C"));
|
||||
locale one(locale("en_US"), new ctype<char>());
|
||||
locale loc(other, one, locale::collate);
|
||||
|
||||
VERIFY( one.name() == "*" );
|
||||
VERIFY( other.name() == "C" );
|
||||
VERIFY( loc.name() == "*" );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user