From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 2B32E386F42D for ; Wed, 19 Aug 2020 11:29:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2B32E386F42D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-210-eg2_htMVPf2B5Fa0Pn6O2w-1; Wed, 19 Aug 2020 07:29:11 -0400 X-MC-Unique: eg2_htMVPf2B5Fa0Pn6O2w-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30900186A570; Wed, 19 Aug 2020 11:29:10 +0000 (UTC) Received: from localhost (unknown [10.33.36.183]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA88F7DFED; Wed, 19 Aug 2020 11:29:09 +0000 (UTC) Date: Wed, 19 Aug 2020 12:29:08 +0100 From: Jonathan Wakely To: Antony Polukhin Cc: Ville Voutilainen , libstdc++ , gcc-patches List Subject: Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type Message-ID: <20200819112908.GI3400@redhat.com> References: <20190508211032.GD2599@redhat.com> <20190530163808.GP2599@redhat.com> <20190531103550.GV2599@redhat.com> <20190606121912.GP2599@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 11:29:14 -0000 On 12/08/20 11:19 +0300, Antony Polukhin via Libstdc++ wrote: >Fixed patch for type traits hardening > >Changelog > >2020-08-12 Antony Polukhin > > PR libstdc/71579 > * include/std/type_traits (invoke_result, is_nothrow_invocable_r) > Add static_asserts to make sure that the argument of the type > trait is not misused with incomplete types. > (is_swappable_with, is_nothrow_swappable_with): Add static_asserts > to make sure that the first and second arguments of the type trait > are not misused with incomplete types. > * testsuite/20_util/invoke_result/incomplete_neg.cc: New test. > * testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc: New test. > * testsuite/20_util/is_nothrow_swappable/incomplete_neg.cc: New test. > * testsuite/20_util/is_nothrow_swappable_with/incomplete_neg.cc: New > test. > * testsuite/20_util/is_swappable_with/incomplete_neg.cc: New test. Thanks, pushed to master. Do we also want to check (std::__is_complete_or_unbounded(__type_identity<_ArgTypes>{}) && ...) for invoke_result and the is_invocable traits? We can use a fold expression there, because those traits are not defined before C++17.