From patchwork Wed Jul 4 09:02:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 939182 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-480998-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="ZAOT3h0X"; 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 41LFQh0DJXz9s29 for ; Wed, 4 Jul 2018 19:03:39 +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=tDLMUL1uILbiZF/oepYDcvlRXGATY8gF1CSsz/dFUoR3X5gumUH1h C2uXPiRQSrYqBLCMzgVtjeLOfL0X/O1mzl56oom0xeUjNcjZEWR5y1nVJWqCaKe4 XBMaV0pOY7udHERKSSwsCAZS8tSiMzSunv5Jau9k+GHVeR9kT3mL0w= 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=abJmD25JNKENR5qverDAffP+CU8=; b=ZAOT3h0X5VjoAsUfJAkZ pFn9r6SeFlmMc2blzCwcor71Dwqh/fPt/09ZVyoPl/7o7hmHDK55Vw+s3YEy0GLP CKV1VZkkmlsLQJXggrO/CRkR68I5aBBXYwROePqMpy5Ty3EiS6SWy4BiK6iA2ENJ 2nZiGAZmcoqhhuou2ljH8+U= Received: (qmail 13283 invoked by alias); 4 Jul 2018 09:03:18 -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 12862 invoked by uid 89); 4 Jul 2018 09:02:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.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.2 spammy=sick X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Jul 2018 09:02:21 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C86EB8160F82; Wed, 4 Jul 2018 09:02:05 +0000 (UTC) Received: from localhost (unknown [10.33.36.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AC962156889; Wed, 4 Jul 2018 09:02:05 +0000 (UTC) Date: Wed, 4 Jul 2018 10:02:04 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR libstdc++/86398 fix std::is_trivially_constructible regression Message-ID: <20180704090204.GA5473@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.2 (2017-12-15) The intrinsic doesn't check for allowed conversions between scalar types, so restore the std::is_constructible check. Also make some trivial whitespace changes. PR libstdc++/86398 * include/std/type_traits (is_trivially_constructible): Check is_constructible before __is_trivially_constructible. * testsuite/20_util/is_trivially_constructible/value.cc: Add more tests, including negative cases. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Use zero for dg-error lineno. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. I got sick of repeatedly adjusting the dg-error lines in the make_signed/make_unsigned tests so have just changed them to match any line. Tested powerpc64le-linux, committed to trunk. commit dfa577ddbb6a4161f23e61fde5ca9ca09753a4ab Author: Jonathan Wakely Date: Wed Jul 4 09:40:07 2018 +0100 PR libstdc++/86398 fix std::is_trivially_constructible regression The intrinsic doesn't check for allowed conversions between scalar types, so restore the std::is_constructible check. Also make some trivial whitespace changes. PR libstdc++/86398 * include/std/type_traits (is_trivially_constructible): Check is_constructible before __is_trivially_constructible. * testsuite/20_util/is_trivially_constructible/value.cc: Add more tests, including negative cases. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Use zero for dg-error lineno. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index accea6df648..4df82bf6d8c 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1136,7 +1136,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_trivially_constructible template struct is_trivially_constructible - : public __bool_constant<__is_trivially_constructible(_Tp, _Args...)> + : public __and_, __bool_constant< + __is_trivially_constructible(_Tp, _Args...)>>::type { }; /// is_trivially_default_constructible @@ -1159,21 +1160,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_implicitly_default_constructible_impl - : public __do_is_implicitly_default_constructible_impl - { - typedef decltype(__test(declval<_Tp>())) type; - }; + : public __do_is_implicitly_default_constructible_impl + { + typedef decltype(__test(declval<_Tp>())) type; + }; template struct __is_implicitly_default_constructible_safe - : public __is_implicitly_default_constructible_impl<_Tp>::type - { }; + : public __is_implicitly_default_constructible_impl<_Tp>::type + { }; template struct __is_implicitly_default_constructible - : public __and_, - __is_implicitly_default_constructible_safe<_Tp>> - { }; + : public __and_, + __is_implicitly_default_constructible_safe<_Tp>> + { }; /// is_trivially_copy_constructible diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc index d2ab27df86f..f260c2a7927 100644 --- a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc @@ -44,124 +44,140 @@ void test01() using std::is_trivially_constructible; using namespace __gnu_test; - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), "PR 86398"); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(true), ""); - static_assert(test_property(false), ""); - static_assert(test_property(false), ""); - - } diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 1380fc55c82..53cdf61f496 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -47,4 +47,4 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 39 } // { dg-error "required from here" "" { target *-*-* } 41 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1825 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index cbc5300c182..ec5b6111127 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -47,5 +47,4 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 39 } // { dg-error "required from here" "" { target *-*-* } 41 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1708 } - +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 }