public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101465] New: Poorly worded error from a call to a pointer-to-member function not wrapped in parentheses
@ 2021-07-15 18:57 josephcsible at gmail dot com
  2021-07-15 20:43 ` [Bug c++/101465] " redi at gcc dot gnu.org
  2021-07-23 19:30 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: josephcsible at gmail dot com @ 2021-07-15 18:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101465

            Bug ID: 101465
           Summary: Poorly worded error from a call to a pointer-to-member
                    function not wrapped in parentheses
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: josephcsible at gmail dot com
  Target Milestone: ---

Consider this C++ code:

struct foo *x;

void (foo::*myfuncptr)();

void f() {
    x->*myfuncptr();
}

This fails to compile, as it should. The problem is that the error I get says I
"must use '.*' or '->*' to call pointer-to-member function", even though I'm
already using '->*'. The actual change I need to make is to add parentheses,
like this: "(x->*myfuncptr)();" We should make the error say this instead.

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

* [Bug c++/101465] Poorly worded error from a call to a pointer-to-member function not wrapped in parentheses
  2021-07-15 18:57 [Bug c++/101465] New: Poorly worded error from a call to a pointer-to-member function not wrapped in parentheses josephcsible at gmail dot com
@ 2021-07-15 20:43 ` redi at gcc dot gnu.org
  2021-07-23 19:30 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-15 20:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101465

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-07-15
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And we should issue a fix-it suggestion too.

I thought this was a dup of an existing bug, but I can't find one, so
confirmed.

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

* [Bug c++/101465] Poorly worded error from a call to a pointer-to-member function not wrapped in parentheses
  2021-07-15 18:57 [Bug c++/101465] New: Poorly worded error from a call to a pointer-to-member function not wrapped in parentheses josephcsible at gmail dot com
  2021-07-15 20:43 ` [Bug c++/101465] " redi at gcc dot gnu.org
@ 2021-07-23 19:30 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-23 19:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101465

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2021-07-15 00:00:00         |2021-7-23

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang outputs something which is worse than even GCC does:

<source>:6:18: error: called object type 'void (foo::*)()' is not a function or
function pointer
    x->*myfuncptr();
        ~~~~~~~~~^
1 error generated.

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

end of thread, other threads:[~2021-07-23 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 18:57 [Bug c++/101465] New: Poorly worded error from a call to a pointer-to-member function not wrapped in parentheses josephcsible at gmail dot com
2021-07-15 20:43 ` [Bug c++/101465] " redi at gcc dot gnu.org
2021-07-23 19:30 ` pinskia 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).