From patchwork Fri Oct 14 00:12:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 119665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F1B93B6F80 for ; Fri, 14 Oct 2011 11:14:27 +1100 (EST) Received: (qmail 25755 invoked by alias); 14 Oct 2011 00:14:21 -0000 Received: (qmail 25721 invoked by uid 22791); 14 Oct 2011 00:14:12 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Oct 2011 00:13:55 +0000 Received: from ucsinet23.oracle.com (ucsinet23.oracle.com [156.151.31.71]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p9E0DqAv021859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 14 Oct 2011 00:13:53 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet23.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p9E0DpwL007096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 14 Oct 2011 00:13:51 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p9E0Djtw000790; Thu, 13 Oct 2011 19:13:46 -0500 Received: from [192.168.1.4] (/79.53.234.225) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 13 Oct 2011 17:13:45 -0700 Message-ID: <4E977E54.9070103@oracle.com> Date: Fri, 14 Oct 2011 02:12:04 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] libstdc++/50714 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, tested x86_64-linux, committed to mainline. Thanks, Paolo. ///////////////////// 2011-10-13 Paolo Carlini PR libstdc++/50714 * include/bits/codecvt.h (codecvt<>::codecvt(size_t)): Initialize _M_c_locale_codecvt member. * testsuite/22_locale/codecvt_byname/50714.cc: New. Index: include/bits/codecvt.h =================================================================== --- include/bits/codecvt.h (revision 179947) +++ include/bits/codecvt.h (working copy) @@ -292,7 +292,9 @@ explicit codecvt(size_t __refs = 0) - : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs) { } + : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs), + _M_c_locale_codecvt(0) + { } explicit codecvt(__c_locale __cloc, size_t __refs = 0); Index: testsuite/22_locale/codecvt_byname/50714.cc =================================================================== --- testsuite/22_locale/codecvt_byname/50714.cc (revision 0) +++ testsuite/22_locale/codecvt_byname/50714.cc (revision 0) @@ -0,0 +1,94 @@ +// { dg-require-namedlocale "de_DE" } + +// Copyright (C) 2011 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 3, 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 COPYING3. If not see +// . + +#include + +#define mychar unsigned short + +namespace std +{ + template<> codecvt::~codecvt() + { } + + template<> + codecvt::result + codecvt:: + do_out(state_type&, const intern_type*, const intern_type*, + const intern_type*&, extern_type*, extern_type*, + extern_type*&) const + { return codecvt_base::ok; } + + template<> + codecvt::result + codecvt:: + do_in(state_type&, const extern_type*, const extern_type*, + const extern_type*&, intern_type*, intern_type*, + intern_type*&) const + { return codecvt_base::ok; } + + template<> + codecvt::result + codecvt:: + do_unshift(state_type&, extern_type*, extern_type*, + extern_type*&) const + { return noconv; } + + template<> + int + codecvt::do_encoding() const + { return 0; } + + template<> + bool + codecvt::do_always_noconv() const + { return false; } + + template<> + int + codecvt:: + do_length(state_type&, const extern_type*, const extern_type*, + size_t) const + { return 0; } + + template<> + int + codecvt::do_max_length() const + { return 4; } +} + +// libstdc++/50714 +void test01() +{ + using namespace std; + + { + locale loc(locale::classic(), + new codecvt()); + } + { + locale loc2(locale::classic(), + new codecvt_byname("de_DE")); + } +} + +int main() +{ + test01(); + return 0; +}