[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 gcc-bugzilla@gcc.gnu.org
Thu Jul 15 18:57:15 GMT 2021


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.


More information about the Gcc-bugs mailing list