From patchwork Fri May 10 21:45:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1098346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500471-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="XNWoRBK8"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4513gD2tTtz9s5c for ; Sat, 11 May 2019 07:46:00 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=f2mBZK8hNTGguR5/fPxAVgXJIW7CdHetDsjBcmtv3MecT7L5Kbabw aICzKLuZdqyS/OsJMtFY+IcmixG39nNShZbhMObzyVMtcYHfWrOhegHjLHaH+PGu HV9XnQOeNgTBWs7CT0vEIQSyZZMfezRH6GJXa7RXPjQw4DTaxS4p4M= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=EHuObR/U71uWGlbcmWUkwT4KoEY=; b=XNWoRBK87LmtSYS7WInt eV3ns0Hu+ua+moPwpd70vmjelL47Mj9vNLmpGHlDGIkxbsSy3HsebMCxR0PE57Tc iPimwb3/zhdCWdlg+lIURboQ6xmYXwt3e2hnRWmWO8B61e7zIfWsy1Xvg/z4jikb mVL/QISB/K8HiAl8ZYNfovc= Received: (qmail 21770 invoked by alias); 10 May 2019 21:45:51 -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 21755 invoked by uid 89); 10 May 2019 21:45:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=4027, friend X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 May 2019 21:45:50 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D954281DE6; Fri, 10 May 2019 21:45:48 +0000 (UTC) Received: from localhost (unknown [10.33.36.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86F885D70D; Fri, 10 May 2019 21:45:48 +0000 (UTC) Date: Fri, 10 May 2019 22:45:47 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR libstdc++/90397 fix std::variant friend declarations Message-ID: <20190510214547.GA23352@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.11.3 (2019-02-01) Clang diagnoses the inconsistent noexcept-specifier on the friend declaration of __get. Add it, and also on __get_storage. PR libstdc++/90397 * include/std/variant (_Variant_storage::_M_storage()) (_Variant_storage::_M_reset())) (_Variant_storage::_M_storage())): Add noexcept. (__get_storage): Likewise. (variant): Add noexcept to friend declarations for __get and __get_storage. Tested powerpc64le-linux (and with clang), committed to trunk. Backport to gcc-9-branch to follow soon. commit ca72894f26baa3702ba0b699564bd3e356a98dba Author: Jonathan Wakely Date: Fri May 10 22:17:41 2019 +0100 PR libstdc++/90397 fix std::variant friend declarations Clang diagnoses the inconsistent noexcept-specifier on the friend declaration of __get. Add it, and also on __get_storage. PR libstdc++/90397 * include/std/variant (_Variant_storage::_M_storage()) (_Variant_storage::_M_reset())) (_Variant_storage::_M_storage())): Add noexcept. (__get_storage): Likewise. (variant): Add noexcept to friend declarations for __get and __get_storage. diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 8c7d7f37fe2..d539df125bf 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -402,7 +402,7 @@ namespace __variant { _M_reset(); } void* - _M_storage() const + _M_storage() const noexcept { return const_cast(static_cast( std::addressof(_M_u))); @@ -432,11 +432,11 @@ namespace __variant _M_index(_Np) { } - void _M_reset() + void _M_reset() noexcept { _M_index = variant_npos; } void* - _M_storage() const + _M_storage() const noexcept { return const_cast(static_cast( std::addressof(_M_u))); @@ -760,7 +760,7 @@ namespace __variant // Returns the raw storage for __v. template - void* __get_storage(_Variant&& __v) + void* __get_storage(_Variant&& __v) noexcept { return __v._M_storage(); } template @@ -1556,10 +1556,12 @@ namespace __variant #endif template - friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v); + friend constexpr decltype(auto) + __detail::__variant::__get(_Vp&& __v) noexcept; template - friend void* __detail::__variant::__get_storage(_Vp&& __v); + friend void* + __detail::__variant::__get_storage(_Vp&& __v) noexcept; #define _VARIANT_RELATION_FUNCTION_TEMPLATE(__OP) \ template \