From patchwork Wed Oct 24 17:20:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 193869 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]) by ozlabs.org (Postfix) with SMTP id 85DC82C0168 for ; Thu, 25 Oct 2012 04:21:00 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351704060; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=WyyPcDDVozZlEMpucuUg1jHUsp4=; b=tsHlDbBfOs1svsl r8vN7p6btDiwwAgQCQo/8nKxGNcUwZiaa4K175z64KxQJgK/53CqPnNR31HAfJhq W8fmRxS/NUTpSe56x0M+A6gZTAmLKkBV2nD5cmp+Ctz7owf4+1qWeLT8Uiicb1cg W3tU1DzjXdaLou8Nmw2VdJpCMNS4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=nmVxAo3fQeUtua/d54FmM4boT8UR2GW0HVo9PYFZe9ymLV9280XPfcf71Z2ycw XXu7cRgciz7tG3765rt4ECKs7xnWc39Ep2EY5XLSUhKHMaq2vXH8RuIU5BwbpKMT NdpxflLot72boiKmyTp0/qaP3NNCXVFbEAs57uvk5Wqpw=; Received: (qmail 10797 invoked by alias); 24 Oct 2012 17:20:53 -0000 Received: (qmail 10787 invoked by uid 22791); 24 Oct 2012 17:20:52 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL, BAYES_00, FSL_NEW_HELO_USER, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_NEUTRAL X-Spam-Check-By: sourceware.org Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 24 Oct 2012 17:20:47 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q9OHKjql007400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Oct 2012 17:20:46 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q9OHKjUR014502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Oct 2012 17:20:45 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q9OHKi4r028456; Wed, 24 Oct 2012 12:20:44 -0500 Received: from [192.168.1.4] (/79.52.211.59) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 24 Oct 2012 10:20:44 -0700 Message-ID: <5088236A.4060408@oracle.com> Date: Wed, 24 Oct 2012 19:20:42 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 34892 X-IsSubscribed: yes 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 Hi, a *very* old ICE on invalid, even a regression (from before variadic templates, I guess!). I tried various other tweaks, like catching the issue earlier but diagnostic quality decreases, too many cascading error messages. The below means I have to tweak only a couple of existing testcases, and I'm actually pretty happy with that, because we produce much less verbose diagnostic in both cases (1 error message less / 2 respectively). Tested x86_64-linux. Thanks, Paolo. ////////////////////////// /cp 2012-10-24 Paolo Carlini PR c++/34892 * pt.c (coerce_template_parms): Check TREE_PURPOSE (parm) for error_mark_node. /testsuite 2012-10-24 Paolo Carlini PR c++/34892 * g++.dg/template/crash114.C: New. * g++.dg/template/crash55.C: Tweak dg-error directive. * g++.dg/template/crash57.C: Likewise. Index: cp/pt.c =================================================================== --- cp/pt.c (revision 192762) +++ cp/pt.c (working copy) @@ -6645,11 +6645,12 @@ coerce_template_parms (tree parms, /* Get the Ith template parameter. */ parm = TREE_VEC_ELT (parms, parm_idx); - if (parm == error_mark_node) - { - TREE_VEC_ELT (new_inner_args, arg_idx) = error_mark_node; - continue; - } + if (parm == error_mark_node + || TREE_PURPOSE (parm) == error_mark_node) + { + TREE_VEC_ELT (new_inner_args, arg_idx) = error_mark_node; + continue; + } /* Calculate the next argument. */ if (arg_idx < nargs) Index: testsuite/g++.dg/template/crash114.C =================================================================== --- testsuite/g++.dg/template/crash114.C (revision 0) +++ testsuite/g++.dg/template/crash114.C (working copy) @@ -0,0 +1,5 @@ +// PR c++/34892 + +template struct A {}; // { dg-error "expected" } +// { dg-message "variadic" "" { target c++98 } 3 } +A<0> a; // { dg-error "type" } Index: testsuite/g++.dg/template/crash55.C =================================================================== --- testsuite/g++.dg/template/crash55.C (revision 192762) +++ testsuite/g++.dg/template/crash55.C (working copy) @@ -3,4 +3,4 @@ template // { dg-error "nested-name-specifier|two or more|valid type" } struct A {}; -template void foo(A); // { dg-error "mismatch|constant|template argument" } +template void foo(A); // { dg-error "type|template" } Index: testsuite/g++.dg/template/crash57.C =================================================================== --- testsuite/g++.dg/template/crash57.C (revision 192762) +++ testsuite/g++.dg/template/crash57.C (working copy) @@ -7,4 +7,4 @@ template struct B template struct C; // { dg-error "token" } }; -A a; // { dg-error "type/value mismatch|constant|declaration" } +A a; // { dg-error "type" }