On Wed, Oct 19, 2011 at 4:34 PM, Paolo Carlini <paolo.carl...@oracle.com> wrote:
> Hi,
>
> in these two twin PRs filed by Ian and Gerald, it is pointed out that cases
> like:
>
>   struct C {
>     int f() { return 1; }
>   };
>
>   int f(C&c) {
>     return ( 1 == c.f );
>   }
>
> 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 ‘&’ ?)
>
> Thus, the idea of saying instead
>
> invalid use of member (did you forget the ‘()’ ?)
>
> 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 type),
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 function?)

Reply via email to