From patchwork Fri Nov 15 15:44:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 291604 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 512AC2C00AD for ; Sat, 16 Nov 2013 02:45:19 +1100 (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:references :in-reply-to:content-type; q=dns; s=default; b=OOa8pwn7pMiEQOSis W4btnrtoRcwH8YBHxGgGCs6HtgyR8ROJRsULFeHYzDO3Nwz6Hex1s6Hdi566vaPj rlbCfZ8phi+N01vliXNHTqa2v7B+bLqqE1PqQzzYJozcTapkDKBg2Ru4XLI8IMCO JvsvLFbyezT42BqUWbm62Lsp30= 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:references :in-reply-to:content-type; s=default; bh=mclXjX5cxq0vJBEuPnKSID3 GmPU=; b=fobbX3DVNbdBTyWdYt41BD9gwpeCcTFPIYn1XWuYqFfgo++c2ciNPnN YhMTq0g5BhZelSMssMA1nXX6dLkwgf4UxB1cdDUzRnyRf7K/NZE63sILGkdTGOZ7 ShEcm/Nhsf3B7D/g5S3sZf7K9Ebg3GH8njEyG6hQHON9eNQ2YIwg= Received: (qmail 29470 invoked by alias); 15 Nov 2013 15:45:09 -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 29453 invoked by uid 89); 15 Nov 2013 15:45:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPF_PASS, UNPARSEABLE_RELAY autolearn=no version=3.3.2 X-HELO: aserp1040.oracle.com Received: from Unknown (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 15 Nov 2013 15:45:07 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rAFFiwa6016083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Nov 2013 15:44:59 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAFFivOH000433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Nov 2013 15:44:58 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAFFivuM007269; Fri, 15 Nov 2013 15:44:57 GMT Received: from poldo4.casa (/79.25.197.192) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 15 Nov 2013 07:44:56 -0800 Message-ID: <52864177.8030500@oracle.com> Date: Fri, 15 Nov 2013 16:44:55 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Jason Merrill , "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch/RFC] PR 29143 References: <52822F0F.8010305@oracle.com> <52824E6F.8040807@redhat.com> In-Reply-To: <52824E6F.8040807@redhat.com> X-IsSubscribed: yes Hi, On 11/12/2013 04:51 PM, Jason Merrill wrote: > Please add a comment citing 13.3.1.1. OK with that change. Thanks. The patch is still unapplied, because there are some interactions with access control (and bugs we have got about access control) which make me a bit nervous. For example for a testcase like the below, with the patch applied we end up emitting two errors: for C<&A::f> and then also, redundantly, for return T(): class A { static int f(); }; template struct C { virtual int g() { return T(); } }; void u() { new C<&A::f>(); } obviously, at some point we have to work on various access control issues wrt templates and make sure that consistently in such cases we warn for the template argument and only for the argument. By consistently I mean, for example, also for C. Anyway, for the time being, the problem filed in 29143 is only about OVERLOADs, not about FUNCTION_DECLs, which are already fine, thus I'm wondering if we could instead apply something like attached (+ a comment). What do you think? Thanks, Paolo. ////////////////////// Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 204697) +++ cp/semantics.c (working copy) @@ -2183,6 +2183,10 @@ finish_call_expr (tree fn, vec **args } } + if (TREE_CODE (fn) == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (fn, 0)) == OVERLOAD) + fn = TREE_OPERAND (fn, 0); + if (is_overloaded_fn (fn)) fn = baselink_for_fns (fn); Index: testsuite/g++.dg/overload/addr2.C =================================================================== --- testsuite/g++.dg/overload/addr2.C (revision 0) +++ testsuite/g++.dg/overload/addr2.C (working copy) @@ -0,0 +1,13 @@ +// PR c++/29143 + +void f(int); + +void g(int,int); +void g(int,int,int); + +void +h () +{ + (&f)(1); + (&g)(1,2,3); +} Index: testsuite/g++.old-deja/g++.other/overload11.C =================================================================== --- testsuite/g++.old-deja/g++.other/overload11.C (revision 204697) +++ testsuite/g++.old-deja/g++.other/overload11.C (working copy) @@ -32,7 +32,7 @@ int main (int argc, char **argv) void (*vptr) (); (ovl) (1); // ok - (&ovl) (1); // { dg-error "" } not suitable for overload resolution + (&ovl) (1); // ok (ovl) (); // { dg-error "" } no matching candidates // { dg-message "candidate" "candidate note" { target *-*-* } 36 } (&ovl) (); // { dg-error "" } not suitable for overload resolution