From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1727 invoked by alias); 19 Oct 2011 21:43:53 -0000 Received: (qmail 1718 invoked by uid 22791); 19 Oct 2011 21:43:52 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Oct 2011 21:43:36 +0000 Received: by wwe32 with SMTP id 32so2111647wwe.8 for ; Wed, 19 Oct 2011 14:43:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.81.196 with SMTP id y4mr13669733fak.6.1319060615071; Wed, 19 Oct 2011 14:43:35 -0700 (PDT) Received: by 10.152.11.36 with HTTP; Wed, 19 Oct 2011 14:43:35 -0700 (PDT) In-Reply-To: <4E9F4265.6080809@oracle.com> References: <4E9F4265.6080809@oracle.com> Date: Wed, 19 Oct 2011 22:18:00 -0000 Message-ID: Subject: Re: [C++ Patch] PR 48630 (PR 31423) From: Gabriel Dos Reis To: Paolo Carlini Cc: "gcc-patches@gcc.gnu.org" , Jason Merrill Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg01785.txt.bz2 On Wed, Oct 19, 2011 at 4:34 PM, Paolo Carlini w= rote: > Hi, > > in these two twin PRs filed by Ian and Gerald, it is pointed out that cas= es > like: > > =A0 struct C { > =A0 =A0 int f() { return 1; } > =A0 }; > > =A0 int f(C&c) { > =A0 =A0 return ( 1 =3D=3D c.f ); > =A0 } > > where the user actually forgot the open-closed round braces are much more > likely than cases where an ampersand is missing, still we output > > invalid use of member (did you forget the =91&=92 ?) > > Thus, the idea of saying instead > > invalid use of member (did you forget the =91()=92 ?) > > which I implemented in the patchlet below. Alternately we could give both > hints, or refer to the argument list. I agree that '()' is a better default. But we can do better. We can use the type context, e.g. in initialization or return-statement etc., to decide whether () is intended (by looking at the TREE_TYPE of a member function ty= pe), and only in cases where we can't tell we suggest both alternative: (did you intend a function call or address of non-static member functi= on?)