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

            Bug ID: 125342
           Summary: undiagnosed virt-specifier in ptr-to-memfn declaration
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aoliva at gcc dot gnu.org
  Target Milestone: ---

// { dg-do compile }
struct S {
  /* virtual */ void m();
};
void (S::*pf)() final = &S::m; // { dg-error "final" }
void (S::*po)() override = &S::m; // { dg-error "override" }

from [class.mem], "A virt-specifier-seq shall appear only in the first
declaration of a virtual member function"

Even if the member function were virtual, these specifiers don't belong in
pointer-to-memfn declarations.

Reply via email to