From patchwork Thu Oct 29 11:02:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 537789 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 1BED6140FDA for ; Thu, 29 Oct 2015 22:03:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=cDxdwe1q; 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=tamReaYe9d9tN39sngWlUAeBQxdpQ/ejfwVyTRLi7yjBG9FxJG EmX2AYVHCuCXrnsG/Hlmv58Cz5VbSOORAyokp2qNkW73dMuHJ5FgU5Htg947w4xJ f/l7Tb68DhVbJOfdQk51VPnpvBhhx+rvAVubz0kEVfGurHlPfkbdZG6K0= 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=1cVFYgRES1dRbD15doOey1GGitc=; b=cDxdwe1qx0D80NG+WgFt bWFReeBMo67UIgM9p0DTxylr4T1PT0cYU2vDwYrv9DWpI3HsBWBr0tCcCbkC/azd mflDNbGkwiSpIyabQLBfnblY7Snff6H0V7g+idENHroFgzxld5jtDa0OVKZc3Klj r4sKI5WRelaHQzNmbxQomtU= Received: (qmail 117260 invoked by alias); 29 Oct 2015 11:02:56 -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 117226 invoked by uid 89); 29 Oct 2015 11:02:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 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, 29 Oct 2015 11:02:54 +0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t9TB2qgW015335 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 29 Oct 2015 11:02:52 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t9TB2qZb005935 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 29 Oct 2015 11:02:52 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t9TB2quJ004857; Thu, 29 Oct 2015 11:02:52 GMT Received: from [192.168.1.4] (/87.3.196.211) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 29 Oct 2015 04:02:52 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 67845 Message-ID: <5631FCD9.30402@oracle.com> Date: Thu, 29 Oct 2015 12:02:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, adjusting at the same time TREE_TYPE of the already built decl, avoids ICEing during error recovery in merge_types for this kind of snippet. Tested x86_64-linux. Thanks, Paolo. //////////////////////////// /cp 2015-10-29 Paolo Carlini PR c++/67845 * decl.c (grokfndecl): In case of erroneous cv-qualified non-member functions consistently reset TREE_TYPE (decl) too. /testsuite 2015-10-29 Paolo Carlini PR c++/67845 * g++.dg/other/cv_func4.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 229518) +++ cp/decl.c (working copy) @@ -7998,6 +7998,11 @@ grokfndecl (tree ctype, DECL_EXTERNAL (decl) = 1; if (TREE_CODE (type) == FUNCTION_TYPE) { + if (quals || rqual) + TREE_TYPE (decl) = apply_memfn_quals (TREE_TYPE (decl), + TYPE_UNQUALIFIED, + REF_QUAL_NONE); + if (quals) { error (ctype Index: testsuite/g++.dg/other/cv_func4.C =================================================================== --- testsuite/g++.dg/other/cv_func4.C (revision 0) +++ testsuite/g++.dg/other/cv_func4.C (working copy) @@ -0,0 +1,6 @@ +// PR c++/67845 + +typedef void F () const; + +F foo; // { dg-error "cv-qualifier" } +void foo ();