From patchwork Fri Mar 7 17:54:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 328035 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 A9A932C00B2 for ; Sat, 8 Mar 2014 04:55:17 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=Hds4Px+JvRxllfpByV5tE/e8/CJiMBnYhdZsYvy1VfN 10Ch9bS/fdjUU1Xi4SE+nfPq+U60Gk+tOJb2kwcmzitoy8srACvza08b1ljnHpok XSNTGxedp9N59PhTonDtwEGkfnABHcvJZzlzBggCKRwlYdTlezkVJq669guafI1o = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=6cd3Pk753bAc59t86p1EB94czIc=; b=nyTTUr8hkPx56IuDE IHrd3vX9J4mDsmC+PBUBK77sVcCx1wVNspajprtD6WzdoRandax34ajlBsnks3IP 7qmDh3Bw0kwRNfsHtoyNcHQwP1mLvQfW+E0n+aYE6eGS3k4PNzZrnfkqBjUEYtDT dhycEOgfjiO6dHit5dC3csRd9E= Received: (qmail 4048 invoked by alias); 7 Mar 2014 17:55:10 -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 4036 invoked by uid 89); 7 Mar 2014 17:55:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 07 Mar 2014 17:55:09 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s27Ht6Pb014377 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Mar 2014 17:55:07 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s27Ht5dD018129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Mar 2014 17:55:06 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s27Ht4l8001375; Fri, 7 Mar 2014 17:55:05 GMT Received: from [192.168.1.4] (/79.43.235.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 07 Mar 2014 09:55:04 -0800 Message-ID: <531A07D2.4010703@oracle.com> Date: Fri, 07 Mar 2014 18:54:26 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 58609 X-IsSubscribed: yes Hi, in this regression we ICE during error recovery, much, much later, in the middle-end. In order to avoid that it seems to me that we can safely return NULL_TREE. I'm also taking the occasion to change a pair of errors to error + inform (this is also consistent with eg, the explain-once type messages we have got in do_friend and in resolve_address_of_overloaded_function) Tested x86_64-linux. Thanks, Paolo. //////////////////// /cp 2014-03-07 Paolo Carlini PR c++/58609 * decl.c (check_initializer): Return NULL_TREE after error; consistently use inform. /testsuite 2014-03-07 Paolo Carlini PR c++/58609 * g++.dg/cpp0x/constexpr-ice12.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 208406) +++ cp/decl.c (working copy) @@ -5809,9 +5809,11 @@ check_initializer (tree decl, tree init, int flags "member %qD", decl); if (!explained) { - error ("(an out of class initialization is required)"); + inform (input_location, + "(an out of class initialization is required)"); explained = 1; } + return NULL_TREE; } return init_code; Index: testsuite/g++.dg/cpp0x/constexpr-ice12.C =================================================================== --- testsuite/g++.dg/cpp0x/constexpr-ice12.C (revision 0) +++ testsuite/g++.dg/cpp0x/constexpr-ice12.C (working copy) @@ -0,0 +1,9 @@ +// PR c++/58609 +// { dg-do compile { target c++11 } } + +struct A +{ + static constexpr int&& i = 0; // { dg-error "initialization" } +}; + +int j = A::i;