From patchwork Tue Jul 9 17: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: 257842 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 032992C009A for ; Wed, 10 Jul 2013 03:27:23 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=I+Vka0mE7QgB2WH0uBReLo5YONvEp7+ZWEFp/8enKJyy6g 0lWsR52MyfJ4XY25ONgKwMv30izlRnVh1vS1sZgrG3F2sIWUdJr9yxAkf9RLs2uC PwDjSE4lE3hqcAKWnit1IDagBI/UXGSAlyYtuPUzl6V4R4xe1cJhM1nmjjzQE= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=sWsqtSCBFrxXhMPS5THUnM29mqA=; b=cTj7h9JShCFDxQfQgNSa YxFAjJL+ruVBi6AMpluFj/+V2yyP+lp/xfx8Cm5vu5/QvcJwwFakCqZwWEw1Hnv2 3It4FGNz6+ln1VvdFS/n2yHxqYBE4eQW2v9HG35piJKVlFUhETll9l1szOv8Mx/Q w31/g6H5F7eZ23DmW4FO6gM= Received: (qmail 19621 invoked by alias); 9 Jul 2013 17:27:17 -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 19607 invoked by uid 89); 9 Jul 2013 17:27:17 -0000 X-Spam-SWARE-Status: No, score=-6.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 09 Jul 2013 17:27:12 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r69HRBGi002220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Jul 2013 13:27:11 -0400 Received: from [10.3.113.19] ([10.3.113.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r69HRAxC004539 for ; Tue, 9 Jul 2013 13:27:10 -0400 Message-ID: <51DC47EE.20800@redhat.com> Date: Tue, 09 Jul 2013 13:27:10 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/57831 (ICE with using-declaration and qualified-id in template) X-Virus-Found: No Here instantiating the SCOPE_REF didn't know how to handle seeing a USING_DECL for the name. The right answer is to strip the USING_DECL and return the identifier, as we do in other cases. Tested x86_64-pc-linux-gnu, applying to trunk, 4.8 and 4.7. commit 1d678e7704b74e7dfc0c927c47a0271c8d599b7c Author: Jason Merrill Date: Mon Jul 8 23:36:12 2013 -0400 PR c++/57831 * pt.c (tsubst_copy): Handle USING_DECL. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7a36521..6f290f6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12508,6 +12508,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) case TYPE_DECL: return tsubst (t, args, complain, in_decl); + case USING_DECL: + t = DECL_NAME (t); + /* Fall through. */ case IDENTIFIER_NODE: if (IDENTIFIER_TYPENAME_P (t)) { diff --git a/gcc/testsuite/g++.dg/template/using23.C b/gcc/testsuite/g++.dg/template/using23.C new file mode 100644 index 0000000..abb90de --- /dev/null +++ b/gcc/testsuite/g++.dg/template/using23.C @@ -0,0 +1,15 @@ +// PR c++/57831 + +struct A { + void f(); +}; +template struct B : T { + typedef T base; + using base::f; // If I write "using B::f" it's ok + void g( ) { + B::f(); // This is OK as expected + (this->*&T::f)(); // This is also OK + (this->*&B::f)(); // This causes error + } +}; +template struct B< A >;