From patchwork Wed Oct 19 23:36:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 120708 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 A1DCCB6F91 for ; Thu, 20 Oct 2011 10:39:14 +1100 (EST) Received: (qmail 15340 invoked by alias); 19 Oct 2011 23:39:11 -0000 Received: (qmail 15324 invoked by uid 22791); 19 Oct 2011 23:39:11 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Oct 2011 23:38:52 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p9JNcn4B002314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Oct 2011 23:38:51 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p9JNUllW012608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Oct 2011 23:30:48 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p9JNchmg003787; Wed, 19 Oct 2011 18:38:43 -0500 Received: from [192.168.1.4] (/79.51.25.230) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Oct 2011 16:38:42 -0700 Message-ID: <4E9F5F0C.1050607@oracle.com> Date: Thu, 20 Oct 2011 01:36:44 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 48630 (PR 31423) References: <4E9F4265.6080809@oracle.com> <4E9F4FEA.6050107@redhat.com> In-Reply-To: <4E9F4FEA.6050107@redhat.com> X-IsSubscribed: yes 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 10/20/2011 12:32 AM, Jason Merrill wrote: > Surely we should only make this change for function members. Thanks Gaby and Jason. So, what about the below? Tested x86_64-linux. Paolo. //////////////////// /cp 2011-10-19 Paolo Carlini PR c++/31423 PR c++/48630 * typeck2.c (cxx_incomplete_type_diagnostic): Improve error message for invalid use of member function. /testsuite 2011-10-19 Paolo Carlini PR c++/31423 PR c++/48630 * g++.dg/parse/error43.C: New. Index: cp/typeck2.c =================================================================== --- cp/typeck2.c (revision 180227) +++ cp/typeck2.c (working copy) @@ -428,8 +428,14 @@ cxx_incomplete_type_diagnostic (const_tree value, case OFFSET_TYPE: bad_member: - emit_diagnostic (diag_kind, input_location, 0, - "invalid use of member (did you forget the %<&%> ?)"); + if (DECL_FUNCTION_MEMBER_P (TREE_OPERAND (value, 1))) + emit_diagnostic (diag_kind, input_location, 0, + "invalid use of member function " + "(did you forget the %<()%> ?)"); + else + emit_diagnostic (diag_kind, input_location, 0, + "invalid use of member " + "(did you forget the %<&%> ?)"); break; case TEMPLATE_TYPE_PARM: