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

            Bug ID: 102786
           Summary: PMF constant evaluation bug
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

In the following testcase:

// { dg-do compile { target c++20 } }

struct S {
  virtual constexpr int foo () const { return 42; }
};

constexpr S s;
constexpr auto a = &S::foo;
constexpr auto b = (s.*a) ();
constexpr auto c = (s.*&S::foo) ();

we correctly accept b's initializer, but reject c's initializer with:
error: value ‘1’ of type ‘int (S::*)() const’ is not a constant expression

Reply via email to