From patchwork Thu Apr 14 09:50:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 610407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3qlwsg1ryRz9sDD for ; Thu, 14 Apr 2016 19:50:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HVhLo4C5; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=vBSEMkhw7AmyjZLb5eEIGa/R56lAjzQVJPh1+AIEimA1FNhNxG f+H7x9cTfJOLsfa/4O0yrhJbZinAP/ZRXJG7IF22/x6fQBzLAxG5WO4Mp0UbmyJC H7sKTIqPfY3us5dsLIHGshJmlyYlFYlC6WMDjSNVB9NNEzZTA7aXvHVbY= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=vdxvy4DiqK+fjEG6UtgSdP1LXYs=; b=HVhLo4C5/+rlAX4JM7xp cTO2w50wPfY6F+nddaKsCFgHRFwjvXGdFNdGBcZZFctMz/eLAKy/KWksbXNtgaep dg9bTpPEVP8nP0B7PqfRPf+dV0vv7tdMKVT92aOYJcF8ignd3MNeTQgNSdF7GZWl V7ZJBm+c09TpyuFQG0gnoHA= Received: (qmail 108596 invoked by alias); 14 Apr 2016 09:50:38 -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 108576 invoked by uid 89); 14 Apr 2016 09:50:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=deduction, 2016-04-14 X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 14 Apr 2016 09:50:26 +0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u3E9oNHD019169 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 14 Apr 2016 09:50:23 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u3E9oNMa021814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 14 Apr 2016 09:50:23 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u3E9oM23021432; Thu, 14 Apr 2016 09:50:23 GMT Received: from [192.168.1.4] (/95.235.10.225) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Apr 2016 02:50:22 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 70540 ("[4.9/5/6 Regression] ICE on invalid code in cxx_incomplete_type_diagnostic...") Message-ID: <570F67DC.9030700@oracle.com> Date: Thu, 14 Apr 2016 11:50:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, in this regression we ICE during error recovery after an additional redundant error message. I think it's one of those cases (we have got quite a few elsewhere, in semantics.c too) when it's better to immediately return error_mark_node when mark_used returns false, even if we aren't in a SFINAE context. To be sure, I double checked that in those cases mark_used certainly issues an error, thus we aren't risking creating accepts-invalid bugs, it's only matter of fine tuning error recovery. Tested x86_64-linux. Thanks, Paolo. ///////////////////////////// /cp 2016-04-14 Paolo Carlini PR c++/70540 * semantics.c (process_outer_var_ref): Unconditionally return error_mark_node when mark_used returns false. /testsuite 2016-04-14 Paolo Carlini PR c++/70540 * g++.dg/cpp0x/auto47.C: New. Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 234970) +++ cp/semantics.c (working copy) @@ -3276,7 +3276,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t c tree initializer = convert_from_reference (decl); /* Mark it as used now even if the use is ill-formed. */ - if (!mark_used (decl, complain) && !(complain & tf_error)) + if (!mark_used (decl, complain)) return error_mark_node; bool saw_generic_lambda = false; Index: testsuite/g++.dg/cpp0x/auto47.C =================================================================== --- testsuite/g++.dg/cpp0x/auto47.C (revision 0) +++ testsuite/g++.dg/cpp0x/auto47.C (working copy) @@ -0,0 +1,8 @@ +// PR c++/70540 +// { dg-do compile { target c++11 } } + +void +foo () +{ + auto f = [&] { return f; }; // { dg-error "before deduction" } +}