public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31423]  New: Improve upon "invalid use of member (did you forget the '&' ?)"
@ 2007-04-01 22:01 gerald at pfeifer dot com
  2007-04-02 16:09 ` [Bug c++/31423] " bangerth at dealii dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: gerald at pfeifer dot com @ 2007-04-01 22:01 UTC (permalink / raw)
  To: gcc-bugs

For the program

   struct C {
     int f() { return 1; }
   };

   int f(C &c) {
     return ( 1 == c.f );
   }

we currently issue

   In function 'int f(C&)':
   6: error: invalid use of member (did you forget the '&' ?)

Basically, my thought is that whenever we encounter a comparison of a
member function c.f with a value that is compatible with its return type,
the author of the code probably ment to write c.f() instead of &c.f, so
the error message could propose the former.

Specifically, I suggest to issue
  error: invalid use of member (did you forget the "()" ?)
instead of
  error: invalid use of member (did you forget the '&' ?)
when the return type of the function c.f is an integer type and we
compare against an integer constant as per my original example.


-- 
           Summary: Improve upon "invalid use of member (did you forget the
                    '&' ?)"
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gerald at pfeifer dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31423


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <bug-31423-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-10-21 18:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-01 22:01 [Bug c++/31423] New: Improve upon "invalid use of member (did you forget the '&' ?)" gerald at pfeifer dot com
2007-04-02 16:09 ` [Bug c++/31423] " bangerth at dealii dot org
2009-08-05 15:33 ` manu at gcc dot gnu dot org
2009-08-05 16:41 ` jwakely dot gcc at gmail dot com
2009-08-05 17:55 ` bangerth at gmail dot com
2009-08-05 17:57 ` bangerth at gmail dot com
2009-08-05 18:19 ` manu at gcc dot gnu dot org
2009-08-05 18:47 ` bangerth at gmail dot com
2009-08-06  9:51 ` jwakely dot gcc at gmail dot com
     [not found] <bug-31423-4@http.gcc.gnu.org/bugzilla/>
2011-10-19 21:50 ` paolo.carlini at oracle dot com
2011-10-21 18:21 ` paolo.carlini at oracle dot com
2011-10-21 18:21 ` paolo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).