From patchwork Tue Jan 22 01:27:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 214302 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 864C62C007B for ; Tue, 22 Jan 2013 12:27:25 +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=1359422846; 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=Wo7wgyu VvtN99kYgET7SS3aR39Q=; b=IuAtk+X1ddshLvQwIN2qUPHh9q0eMXR2RhbchUF uFRjXqO7Iktnhskfo3jM7Y1Sa3hRe90iwLK9cJVd+IB1I3/i38lCyoIVJq0PWdHa bnexv02KmrKcy1SBgmDH5nuk/jwE1zj9Q0A6Qb22bBuTACCPxn6F0J3qtmVKx9Ij Cn78= 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=UIhXiz8+dRIQcfzwKINb5eqJKMU8+ehh0itzGIUgZSrFU5/TwbrFlN+9yHrfQ7 D3O4B4zRxhiLifYPjMseMxAe+v95ckbRESchm+KSgU8O1jA10iNN91OmiQjWacIn 0bfkbOoEWqEisxXJAJ1NLGIgK/+5Me6qVXYFHkC87L5ek=; Received: (qmail 22204 invoked by alias); 22 Jan 2013 01:27:20 -0000 Received: (qmail 22133 invoked by uid 22791); 22 Jan 2013 01:27:20 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Tue, 22 Jan 2013 01:27:12 +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 r0M1RBc4015366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Jan 2013 20:27:11 -0500 Received: from [10.3.113.46] (ovpn-113-46.phx2.redhat.com [10.3.113.46]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0M1RBtN010597 for ; Mon, 21 Jan 2013 20:27:11 -0500 Message-ID: <50FDEAEE.4020500@redhat.com> Date: Mon, 21 Jan 2013 20:27:10 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/56059 (ICE on error with decltype) 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 Here when I rebuilt the TREE_VEC of template arguments, I forgot to preserve the count of non-default args. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit ac41deca2b7fcbda67a0e99f112e116589e56ad8 Author: Jason Merrill Date: Mon Jan 21 15:46:57 2013 -0500 PR c++/56059 * tree.c (strip_typedefs_expr) [TREE_VEC]: Preserve non-default template args count. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 2b108c1..d1f14fc 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1351,6 +1351,8 @@ strip_typedefs_expr (tree t) r = copy_node (t); for (i = 0; i < n; ++i) TREE_VEC_ELT (r, i) = (*vec)[i]; + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT + (r, GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (t)); } else r = t; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype48.C b/gcc/testsuite/g++.dg/cpp0x/decltype48.C new file mode 100644 index 0000000..29ce815 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype48.C @@ -0,0 +1,16 @@ +// PR c++/56059 +// { dg-options -std=c++11 } + +typedef int Int; +template struct baz { }; +template T bar(); + +template +baz(bar() ...))> // { dg-error "no match" } +foo(); + +int main() +{ + foo(); // { dg-error "no match" } + return 0; +}