From patchwork Fri Mar 2 17:37:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 880677 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-474210-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="rP4vdDwa"; 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 3ztGjC4fbLz9s3n for ; Sat, 3 Mar 2018 04:37:51 +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=gpUfMvOxd+6swrYSN9K+Tv/MQyr2ZxHrUb9lAsUen6s9uVZcGBp/u SgXkmJhmxkQx5iNU+lmPtpXfcLcEgS3FxvFOTQx9a34UBP9EhDhy7DCSFfhKUkdG tget5327F9OhlEjEVs55qbnj54v/qcTnmDM4y9WiqZMaQTNePiQfFI= 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=yZKzq0DMf4P4Rthd42gCI4VlS40=; b=rP4vdDwa4kcg/Mi0j3qv ROEuCbPftslCaz5BW0K76HGpCN+oYCWLGz2QvWlBPkn9G+eTx+hYE53T0rgmTOLA SybllFxcX5yOq+8fST91GlIW9Szg+6wi/LkQUxpyieLhX+JFkLTh4ZjJYzAfYfOQ HXW78RCTfLDBz1HVesL5oew= Received: (qmail 110332 invoked by alias); 2 Mar 2018 17:37:44 -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 110316 invoked by uid 89); 2 Mar 2018 17:37:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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, 02 Mar 2018 17:37:43 +0000 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 mx1.redhat.com (Postfix) with ESMTPS id C3DD95AFC4 for ; Fri, 2 Mar 2018 17:37:41 +0000 (UTC) Received: from redhat.com (unknown [10.40.205.164]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04FE65D6A8; Fri, 2 Mar 2018 17:37:40 +0000 (UTC) Date: Fri, 2 Mar 2018 18:37:37 +0100 From: Marek Polacek To: Jason Merrill , GCC Patches Subject: C++ PATCH for c++/84664, ICE on invalid in lambda Message-ID: <20180302173737.GL16833@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) This patch fixes an ICE-on-invalid by checking the result of mark_rvalue_use, similarly to perform_implicit_conversion_flags. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2018-03-02 Marek Polacek PR c++/84664 * typeck.c (cp_perform_integral_promotions): Check the result of mark_rvalue_use. * g++.dg/cpp0x/lambda/lambda-ice28.C: New test. Marek diff --git gcc/cp/typeck.c gcc/cp/typeck.c index 0e7c63dd197..f535902231d 100644 --- gcc/cp/typeck.c +++ gcc/cp/typeck.c @@ -2161,6 +2161,8 @@ cp_perform_integral_promotions (tree expr, tsubst_flags_t complain) tree promoted_type; expr = mark_rvalue_use (expr); + if (error_operand_p (expr)) + return error_mark_node; /* [conv.prom] diff --git gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C index e69de29bb2d..5fe32129744 100644 --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C +++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C @@ -0,0 +1,9 @@ +// PR c++/84664 +// { dg-do compile { target c++11 } } + +void +foo () +{ + auto &b = 1; // { dg-error "cannot bind" } + [] { b > 0; }; // { dg-error ".b. is not captured" } +}