From patchwork Mon Nov 7 22:49:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 124211 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 5CFCAB6F75 for ; Tue, 8 Nov 2011 09:49:33 +1100 (EST) Received: (qmail 11027 invoked by alias); 7 Nov 2011 22:49:31 -0000 Received: (qmail 11017 invoked by uid 22791); 7 Nov 2011 22:49:30 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, 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; Mon, 07 Nov 2011 22:49:17 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA7MnGB5019234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Nov 2011 17:49:16 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pA7MnGoD006585 for ; Mon, 7 Nov 2011 17:49:16 -0500 Received: from [0.0.0.0] (ovpn-113-127.phx2.redhat.com [10.3.113.127]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id pA7MnF2h019161 for ; Mon, 7 Nov 2011 17:49:16 -0500 Message-ID: <4EB8606B.8080607@redhat.com> Date: Mon, 07 Nov 2011 17:49:15 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/50870 (ICE with -> X::Y in a template default argument) 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 Dodji's work on template parameter lists of different lengths exposed a problem whereby we weren't handling partial instantiation of a COMPONENT_REF where the member is a SCOPE_REF. Fixed by not messing with it when the object is still dependent. Tested x86_64-pc-linux-gnu, applying to trunk. commit eeb195f0839f33c5ace186a66bdc56188eb194be Author: Jason Merrill Date: Mon Nov 7 16:50:08 2011 -0500 PR c++/50870 * pt.c (tsubst_copy): Handle NAMESPACE_DECL. (tsubst_copy_and_build) [COMPONENT_REF]: Handle a still-dependent object. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c4f4a94..53a5358 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12010,6 +12010,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) mark_used (t); return t; + case NAMESPACE_DECL: + return t; + case OVERLOAD: /* An OVERLOAD will always be a non-dependent overload set; an overload set from function scope will just be represented with an @@ -13871,7 +13874,9 @@ tsubst_copy_and_build (tree t, if (member == error_mark_node) return error_mark_node; - if (object_type && !CLASS_TYPE_P (object_type)) + if (type_dependent_expression_p (object)) + /* We can't do much here. */; + else if (!CLASS_TYPE_P (object_type)) { if (SCALAR_TYPE_P (object_type)) { diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype35.C b/gcc/testsuite/g++.dg/cpp0x/decltype35.C new file mode 100644 index 0000000..d1fd476 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype35.C @@ -0,0 +1,15 @@ +// PR c++/50870 +// { dg-options -std=c++0x } + +template + struct impl + { + template static T create(); + }; + +template ::template create() + -> impl::template create())> +struct tester { }; + +tester*, int, float> ti;