This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31423] New: Improve upon "invalid use of member (did you forget the '&' ?)"
- From: "gerald at pfeifer dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Apr 2007 22:01:41 -0000
- Subject: [Bug c++/31423] New: Improve upon "invalid use of member (did you forget the '&' ?)"
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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