From patchwork Sat May 18 23:11:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 244795 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id AC0A02C0091 for ; Sun, 19 May 2013 09:11:53 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=SPXdbbdEmkf/9lB9xT60IP6vnmMSb7xHkndlrJA5gRkK03 rbmFEq7uAnDABXH2R2YeuCV+ak4CmzUSQVI/0auQBDo2q9pkDn3vjSTnrv2j7Lcb L2PIzu8bkESrR9VVFz3aDeWDENqSCXFFqKZ3DtO161Qo82f8GcPqjSlrzNXok= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=R+DSua7ax9Ktc7+0AenIm16NtWU=; b=t0Mon+Le8bN9PV3r8gGO Syg9gi2lwHeXyR4oPh7M2tdS0RScKcFen58ofKww3KWNNG55dTFHR2Fpn//Wa2cq 5N06ctDy9mSqU2wnO5CtGllZ8sH7r8c1O/5AlNUujbsXLdz5qYnjwjH6Gw4067xr cYUYBzfNRbL2kYFCSTjyh+8= Received: (qmail 595 invoked by alias); 18 May 2013 23:11:28 -0000 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 Received: (qmail 550 invoked by uid 89); 18 May 2013 23:11:28 -0000 X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from mail-la0-f52.google.com (HELO mail-la0-f52.google.com) (209.85.215.52) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 18 May 2013 23:11:27 +0000 Received: by mail-la0-f52.google.com with SMTP id fo13so5398563lab.11 for ; Sat, 18 May 2013 16:11:24 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.126.165 with SMTP id mz5mr8605238lbb.62.1368918684844; Sat, 18 May 2013 16:11:24 -0700 (PDT) Received: by 10.112.166.101 with HTTP; Sat, 18 May 2013 16:11:24 -0700 (PDT) Date: Sun, 19 May 2013 00:11:24 +0100 Message-ID: Subject: [patch] implement LWG 2145 From: Jonathan Wakely To: "libstdc++" , gcc-patches X-Virus-Found: No * include/std/system_error (error_category::error_category()): LWG 2145: Declare public and constexpr. * src/c++11/system_error.cc (error_category::error_category()): Move definition to ... * src/c++11/compatibility-c++0x.cc: Here. Tested x86_64-linux, committed to trunk. For 4.8 we can just make the constructor public but leave it non-inline. diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error index b63b74e..d66b871 100644 --- a/libstdc++-v3/include/std/system_error +++ b/libstdc++-v3/include/std/system_error @@ -65,11 +65,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// error_category class error_category { - protected: + public: +#ifdef _GLIBCXX_COMPATIBILITY_CXX0X error_category() noexcept; +#else + constexpr error_category() noexcept = default; +#endif - public: - virtual ~error_category() noexcept; + virtual ~error_category(); error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; diff --git a/libstdc++-v3/src/c++11/compatibility-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-c++0x.cc index fc84a5e..64a4a6c 100644 --- a/libstdc++-v3/src/c++11/compatibility-c++0x.cc +++ b/libstdc++-v3/src/c++11/compatibility-c++0x.cc @@ -119,6 +119,10 @@ namespace std _GLIBCXX_VISIBILITY(default) }; constexpr bool system_clock::is_monotonic; } // namespace chrono + + // gcc-4.9.0 + // LWG 2145 changes this constructor to constexpr i.e. inline + error_category::error_category() noexcept = default; } #endif diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc index 453c687..65dcef3 100644 --- a/libstdc++-v3/src/c++11/system_error.cc +++ b/libstdc++-v3/src/c++11/system_error.cc @@ -70,8 +70,6 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - error_category::error_category() noexcept = default; - error_category::~error_category() noexcept = default; const error_category&