From patchwork Mon Feb 18 23:02:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1044366 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-496595-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="bODhYvi+"; 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 443KC21d2wz9s6w for ; Tue, 19 Feb 2019 10:02:36 +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:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=e4VNt0okcE1PpBpptlPfJvZdYKZPZ JFukRxX+YtzCLm56yDVWi+wq/e+yEI1HybB6F1dmYRxppnoJcoTpEbBuNwZ2oqzf zgm23N5bCz+UQBr+0Ohe7ekWHOuK8kwztqSzkBRkfEcRYkM/umv5twIVgmISI8KD URK3xTwS+4lbOs= 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:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=w04rqbP1hEu8UvM9jDMAtlfJgZ0=; b=bOD hYvi+Zj/3HNqSfLWeoGmEmKAZC8C3YRmgOIA5x8xVudbFX2h90CBlnGVLnFGK+bQ l4G9eGzBJdbDN7OL/Pi9h0AEmi2s6SJihwPdaWlcU67gBKphdYcKPjNPohTYuaoB uUne6YfY8HpO7zOuWZD1g0xPu2F15ucxT8D0A4W4= Received: (qmail 18058 invoked by alias); 18 Feb 2019 23:02:29 -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 18033 invoked by uid 89); 18 Feb 2019 23:02:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1794, FUNCTION_DECL, function_decl 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; Mon, 18 Feb 2019 23:02:27 +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 51E4178EB1 for ; Mon, 18 Feb 2019 23:02:26 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-188.ams2.redhat.com [10.36.116.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E0D4C648A8; Mon, 18 Feb 2019 23:02:25 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x1IN2NWl011244; Tue, 19 Feb 2019 00:02:24 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x1IN2Nt8011243; Tue, 19 Feb 2019 00:02:23 +0100 Date: Tue, 19 Feb 2019 00:02:23 +0100 From: Jakub Jelinek To: Jason Merrill , Alexandre Oliva Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix maybe_generic_this_capture ICE on USING_DECL (PR c++/89387) Message-ID: <20190218230223.GS2135@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi! On the following testcase, id_expr is false and TREE_CODE (*iter) is USING_DECL (and the following one is FUNCTION_DECL). Since the USING_DECL changes, this ICEs because DECL_NONSTATIC_MEMBER_FUNCTION_P uses TREE_TYPE which can't be used here. Previously, I believe DECL_NONSTATIC_MEMBER_FUNCTION_P would be never true for USING_DECLs. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Or should it use != USING_DECL instead (what should be DECL_NONSTATIC_MEMBER_FUNCTION_P checked on other than FUNCTION_DECL/TEMPLATE_DECL)? 2019-02-18 Jakub Jelinek PR c++/89387 * lambda.c (maybe_generic_this_capture): Don't check DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs. * g++.dg/cpp0x/lambda/lambda-89387.C: New test. Jakub --- gcc/cp/lambda.c.jj 2019-02-18 20:48:32.112741017 +0100 +++ gcc/cp/lambda.c 2019-02-18 21:49:23.319629179 +0100 @@ -941,7 +941,8 @@ maybe_generic_this_capture (tree object, fns = TREE_OPERAND (fns, 0); for (lkp_iterator iter (fns); iter; ++iter) - if ((!id_expr || TREE_CODE (*iter) == TEMPLATE_DECL) + if (((!id_expr && TREE_CODE (*iter) == FUNCTION_DECL) + || TREE_CODE (*iter) == TEMPLATE_DECL) && DECL_NONSTATIC_MEMBER_FUNCTION_P (*iter)) { /* Found a non-static member. Capture this. */ --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C.jj 2019-02-18 21:56:46.410339001 +0100 +++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C 2019-02-18 21:55:58.869119054 +0100 @@ -0,0 +1,11 @@ +// PR c++/89387 +// { dg-do compile { target c++11 } } + +template