From patchwork Sun Mar 4 00:55:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 144471 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 8568DB6EEA for ; Sun, 4 Mar 2012 11:55:57 +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=1331427358; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=eyLR2uKkTP7nHDWQDDGzcedsTbg=; b=IFITmkFPmvoWvwn rtUTt0XF8G5s91i7B4HqWp6OiRtOxdwF7yR53AUZMb/SKH7BRsF0KuW/ldQdraxT mPgJ6Ha5lkJLH6nzkLxyxHPjGw9uSKjNmbQhp15BMAVaULygwqJtT06VP9MSZKrH 5xuzA2g/ofm8cq+D+knz0Zvofno4= 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:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mRDePq7gyFMmwiv25MfjVFfoOaYBWxg/E2aMG0insSfeCFz0T1iEgrsthoBX14 VyeezGY3IBXut7ASamZYobPx+A9bh3jGdn/TwvVVCJHRV6zX4NjKBRuAMw6dET+I CpbY6Bl+Duhzhm0+lFGZm5Zxm7NSJCAnbFiUwoBfVqaDI=; Received: (qmail 15946 invoked by alias); 4 Mar 2012 00:55:52 -0000 Received: (qmail 15921 invoked by uid 22791); 4 Mar 2012 00:55:50 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, MISSING_HEADERS, RCVD_IN_DNSWL_HI, 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; Sun, 04 Mar 2012 00:55:32 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q240tWkD005192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 3 Mar 2012 19:55:32 -0500 Received: from [10.3.113.56] (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q240tWkG016334 for ; Sat, 3 Mar 2012 19:55:32 -0500 Message-ID: <4F52BD83.6010908@redhat.com> Date: Sat, 03 Mar 2012 19:55:31 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 CC: gcc-patches List Subject: Re: C++ PATCH for c++/51925 (ICE with using in template) References: <4F1D9205.8030103@redhat.com> In-Reply-To: <4F1D9205.8030103@redhat.com> 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 On 01/23/2012 11:59 AM, Jason Merrill wrote: > The problem in this case was that a few places in the compiler were > assuming that when we have an OVERLOAD, all the functions within it come > from the same context. But that isn't the case when we have > using-declarations involved, so we need to take them into account. Here's an associated representation change that I held back until stage 1. Tested x86_64-pc-linux-gnu, applying to trunk. commit 98637c44e8829792172581d449b3835588dc5563 Author: Jason Merrill Date: Mon Jan 23 11:06:38 2012 -0500 * class.c (add_method): Always build an OVERLOAD for using-decls. * search.c (lookup_member): Handle getting an OVERLOAD for a single function. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 5d834d9..6ed4cde 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1117,9 +1117,13 @@ add_method (tree type, tree method, tree using_decl) return false; /* Add the new binding. */ - overload = build_overload (method, current_fns); - if (using_decl && TREE_CODE (overload) == OVERLOAD) - OVL_USED (overload) = true; + if (using_decl) + { + overload = ovl_cons (method, current_fns); + OVL_USED (overload) = true; + } + else + overload = build_overload (method, current_fns); if (conv_p) TYPE_HAS_CONVERSION (type) = 1; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index e48dcec..a1f8a3d 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1250,10 +1250,12 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type, only the first call to "f" is valid. However, if the function is static, we can check. */ if (rval && protect - && !really_overloaded_fn (rval) - && !(TREE_CODE (rval) == FUNCTION_DECL - && DECL_NONSTATIC_MEMBER_FUNCTION_P (rval))) - perform_or_defer_access_check (basetype_path, rval, rval); + && !really_overloaded_fn (rval)) + { + tree decl = is_overloaded_fn (rval) ? get_first_fn (rval) : rval; + if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + perform_or_defer_access_check (basetype_path, decl, decl); + } if (errstr && protect) {