From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63880 invoked by alias); 14 Jun 2019 14:05:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 63857 invoked by uid 89); 14 Jun 2019 14:05:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.0 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= 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, 14 Jun 2019 14:05:09 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DB228B288; Fri, 14 Jun 2019 14:05:08 +0000 (UTC) Received: from localhost (unknown [10.33.36.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B7241798D; Fri, 14 Jun 2019 14:05:07 +0000 (UTC) Date: Fri, 14 Jun 2019 14:05:00 -0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Disable -Wctor-dtor-privacy warnings for some standard types Message-ID: <20190614140507.GA24550@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-06/txt/msg00835.txt.bz2 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 409 These types are not constructible by design, so we never want warnings for them, even with -Wsystem-headers. * include/experimental/type_traits (experimental::nonesuch): Use pragma to disable -Wctor-dtor-privacy warnings. * include/std/type_traits (__is_convertible_helper) (__is_nt_convertible_helper, __nonesuch): Likewise. Tested x86_64-linux, committed to trunk. --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 3148 commit bde783a93449ed52ffa301c338b23cd57df0cc77 Author: redi Date: Fri Jun 14 14:03:20 2019 +0000 Disable -Wctor-dtor-privacy warnings for some standard types * include/experimental/type_traits (experimental::nonesuch): Use pragma to disable -Wctor-dtor-privacy warnings. * include/std/type_traits (__is_convertible_helper) (__is_nt_convertible_helper, __nonesuch): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272289 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits index 2403bd24223..464c8d2f4bf 100644 --- a/libstdc++-v3/include/experimental/type_traits +++ b/libstdc++-v3/include/experimental/type_traits @@ -227,6 +227,8 @@ inline namespace fundamentals_v2 template using void_t = void; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" struct __nonesuchbase {}; struct nonesuch : private __nonesuchbase { @@ -234,6 +236,7 @@ struct nonesuch : private __nonesuchbase nonesuch(nonesuch const&) = delete; void operator=(nonesuch const&) = delete; }; +#pragma GCC diagnostic pop template class _Op, typename... _Args> using is_detected diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index e53d3c8d535..7d4deb156a1 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1448,6 +1448,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename is_void<_To>::type type; }; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" template class __is_convertible_helper<_From, _To, false> { @@ -1466,7 +1468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: typedef decltype(__test<_From, _To>(0)) type; }; - +#pragma GCC diagnostic pop /// is_convertible template @@ -1481,6 +1483,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : is_void<_To> { }; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" template class __is_nt_convertible_helper<_From, _To, false> { @@ -1499,6 +1503,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: using type = decltype(__test<_From, _To>(0)); }; +#pragma GCC diagnostic pop // is_nothrow_convertible for C++11 template @@ -2894,12 +2899,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __call_is_nothrow_<_Fn, _Args...>>::type { }; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" struct __nonesuchbase {}; struct __nonesuch : private __nonesuchbase { ~__nonesuch() = delete; __nonesuch(__nonesuch const&) = delete; void operator=(__nonesuch const&) = delete; }; +#pragma GCC diagnostic pop #if __cplusplus >= 201703L # define __cpp_lib_is_invocable 201703 --PEIAKu/WMn1b1Hv9--