From patchwork Tue Jan 28 13:31:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1230321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518403-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.a=rsa-sha1 header.s=default header.b=tetO/euu; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=T1uKehJY; 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 486SFY1X5Tz9s29 for ; Wed, 29 Jan 2020 00:31:44 +1100 (AEDT) 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=J3vkTm+SX2oMH+gc45hit4lStThXkHyqxT02esAG86S9PgHAz5wn+ 4IcbQDn2Dpz9dwSgZUbNe8DphnykVsqDVNGDkicuiYokHeTTC1SPHWzMuug6l7NF lTXnxFyNut00hHiQotgd4IBstj+/ExUYSXqW+e49XLH0Sil3dA1jFU= 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=eQBlNI2br6vLEZjTIf9MjsOFj00=; b=tetO/euu7LUn7nNsOROs OuvG7aslLksZfDfQ8FDbgfRXvCx5HuGrHUaYgVMK47RuuTki7nbm/nyWsSItSq1X RlJ/5rIkwHm4fgMtM33awVA0pV6ZAVyzUyrYCytt6w9NE48sr0Axq0P7aRqj5bkE CPm7Pwa42+/L6ejMRVVqGzY= Received: (qmail 56398 invoked by alias); 28 Jan 2020 13:31:36 -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 56283 invoked by uid 89); 28 Jan 2020 13:31:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2020 13:31:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580218287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=5G6DbOA6F02hNQGVAGvxUqtSSGfJQwXvdBMeYqcNYs4=; b=T1uKehJYLZ77AtmWn5cWg0omSsjdgHaCFzXgUQ7S1UrpDwwN+DP/XtlKtnUcSPFSw8sfUL m/PKE6mO9oyDXuTBMbVhpBadPYUnRWdVXRhA2GUPoia4gKW/y/dZbt0wxCYH2XFphHEpXD OHEdGPJteYGScv02qlTx72tm8Qp2cm8= 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-236-fxcVW3LVMeyfaDycVETi2Q-1; Tue, 28 Jan 2020 08:31:23 -0500 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 F238B1083EA3; Tue, 28 Jan 2020 13:31:22 +0000 (UTC) Received: from localhost (unknown [10.33.36.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1C2086E22; Tue, 28 Jan 2020 13:31:22 +0000 (UTC) Date: Tue, 28 Jan 2020 13:31:21 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [COMMITTED] libstdc++: Avoid using sizeof with function types (PR 93470) Message-ID: <20200128133121.GA53656@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline PR libstdc++/93470 * include/bits/refwrap.h (reference_wrapper::operator()): Restrict static assertion to object types. Tested powerpc64le-linux and verified with Clang. Committed to master. Backport to gcc-9-branch needed too. commit 72a9fd209b6db3b5f81fbb008e22ea93c00465e5 Author: Jonathan Wakely Date: Tue Jan 28 13:24:09 2020 +0000 libstdc++: Avoid using sizeof with function types (PR 93470) PR libstdc++/93470 * include/bits/refwrap.h (reference_wrapper::operator()): Restrict static assertion to object types. diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h index 2bcd44d3894..717aa01629c 100644 --- a/libstdc++-v3/include/bits/refwrap.h +++ b/libstdc++-v3/include/bits/refwrap.h @@ -343,7 +343,8 @@ _GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type) operator()(_Args&&... __args) const { #if __cplusplus > 201703L - static_assert(sizeof(type), "type must be complete"); + if constexpr (is_object_v) + static_assert(sizeof(type), "type must be complete"); #endif return std::__invoke(get(), std::forward<_Args>(__args)...); }