From patchwork Mon Apr 16 03:14:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 152749 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 76322B6FDF for ; Mon, 16 Apr 2012 13:15:08 +1000 (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=1335150908; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=9GkjUrl X8zIScEcTrFbxDoB1HNI=; b=gilISFj7EDRloOtIpFudvqsHEoWTQ7OVo2FtBEh acPalo0CyyAgq0M4yi9mLuCSg3lbNvmcPvxaf9P8O6uTOGEi+5RYkSgZJfebHzS3 sWCYCMjxCIkcjdacwEavlaBmc8hWjC6zqOe4goWfFnp8uRbk7jU8cAK86msExZKW fqIQ= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=achMaapEK3ykRzzSZB7Jtxcr37svyBrKeMs2pJbbVneoKeL/S4tPce48OeJG0r Aq8ixr4EifmYIOL/4ZLDQ8Oy4fKdLYDH6CQrBsJ56V1q+Onf+T0cL5EwLJEJ4pja oLVi8ruBzqv61wlLAccsgwsIU7VDIZYEGJIkY3f8//Jzo=; Received: (qmail 22518 invoked by alias); 16 Apr 2012 03:15:01 -0000 Received: (qmail 22503 invoked by uid 22791); 16 Apr 2012 03:15:00 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Apr 2012 03:14:46 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3G3EkhJ021683 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 15 Apr 2012 23:14:46 -0400 Received: from [10.3.113.15] ([10.3.113.15]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3G3Ej1Y006598 for ; Sun, 15 Apr 2012 23:14:46 -0400 Message-ID: <4F8B8EA5.3050901@redhat.com> Date: Sun, 15 Apr 2012 23:14:45 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/47220 (accepts-invalid with ill-formed variadic argument list) 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 For some reason, coerce_template_parameter_pack wasn't checking for and diagnosing error_mark_node like coerce_template_parms does. Fixed. Tested x86_64-pc-linux-gnu, applying to trunk. commit 601d1dd536710d65054d6a24bbae2bbf7f1e466b Author: Jason Merrill Date: Sun Apr 15 20:58:07 2012 -0400 PR c++/47220 * pt.c (coerce_template_parameter_pack): Check for error_mark_node. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 42dc0a7..95d0aba 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6697,7 +6697,12 @@ coerce_template_parameter_pack (tree parms, TREE_VEC_ELT (packed_types, arg_idx - parm_idx); } - if (arg != error_mark_node) + if (arg == error_mark_node) + { + if (complain & tf_error) + error ("template argument %d is invalid", arg_idx + 1); + } + else arg = convert_template_argument (actual_parm, arg, new_args, complain, parm_idx, in_decl); diff --git a/gcc/testsuite/g++.dg/cpp0x/pr39639.C b/gcc/testsuite/g++.dg/cpp0x/pr39639.C index 4fd8b56..0838a0b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr39639.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr39639.C @@ -2,6 +2,7 @@ // Origin: PR c++/39639 // { dg-do compile } // { dg-options "-std=c++0x" } +// { dg-prune-output "template argument 1 is invalid" } template struct S diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic126.C b/gcc/testsuite/g++.dg/cpp0x/variadic126.C new file mode 100644 index 0000000..513c7e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic126.C @@ -0,0 +1,8 @@ +// PR c++/47220 +// { dg-do compile { target c++11 } } + +template < typename ... > struct A; + +struct B : A < // { dg-error "invalid" } +{ +}; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C index 9ab2589..024afc8 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C @@ -22,7 +22,7 @@ namespace A { template struct I : H {}; - template struct J; + template struct J {}; template struct K; struct L { @@ -36,7 +36,7 @@ namespace A template struct N : L::M {}; template - struct K :J <,>, L + struct K :J <>, L { typedef T O (B4 ...); struct P {};