public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48630] New: Poor g++ suggestion: did you forget the ‘&’
@ 2011-04-15 19:44 ian at airs dot com
  2011-04-16  4:31 ` [Bug c++/48630] " redi at gcc dot gnu.org
  2011-10-19 21:50 ` paolo.carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ian at airs dot com @ 2011-04-15 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Poor g++ suggestion: did you forget the ‘&’
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ian@airs.com


If I compile this C++ test case with current mainline:

class C { public: C* f(); int get(); };
int f(C* p) { return p->f->get(); }

I get this:

foo.cc: In function ‘int f(C*)’:
foo.cc:2:26: error: invalid use of member (did you forget the ‘&’ ?)
foo.cc:2:26: error: base operand of ‘->’ is not a pointer

When I get this error message, it has never been the case that I forgot the
'&'.  It has always been the case that I forgot the '()', or that I typed a
method name where I meant to type a member name.  This particular suggestion
hurts more than it helps.

Some examination of context could probably produce a better suggestion. 
However, if that turns out to be too difficult, I think that overall we would
be better off if this particular suggestion were dropped.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/48630] Poor g++ suggestion: did you forget the ‘&’
  2011-04-15 19:44 [Bug c++/48630] New: Poor g++ suggestion: did you forget the ‘&’ ian at airs dot com
@ 2011-04-16  4:31 ` redi at gcc dot gnu.org
  2011-10-19 21:50 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2011-04-16  4:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.04.16 04:31:12
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-04-16 04:31:12 UTC ---
yep, that diagnostic is pretty poor, see also c8 on PR 31423


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/48630] Poor g++ suggestion: did you forget the ‘&’
  2011-04-15 19:44 [Bug c++/48630] New: Poor g++ suggestion: did you forget the ‘&’ ian at airs dot com
  2011-04-16  4:31 ` [Bug c++/48630] " redi at gcc dot gnu.org
@ 2011-10-19 21:50 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-19 21:50 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-19 21:49:18 UTC ---
Closing as duplicate

*** This bug has been marked as a duplicate of bug 31423 ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15 19:44 [Bug c++/48630] New: Poor g++ suggestion: did you forget the ‘&’ ian at airs dot com
2011-04-16  4:31 ` [Bug c++/48630] " redi at gcc dot gnu.org
2011-10-19 21:50 ` paolo.carlini at oracle dot com

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).