[cfe-users] constexpr pointer-to-member-function broken in Clang 9?

Michael Price - Dev via cfe-users cfe-users at lists.llvm.org
Tue Oct 1 10:42:59 PDT 2019

Should this be ill-formed?

struct C {
  constexpr C() {}
  constexpr bool f() const { return true; }
constexpr C c{};

constexpr bool fails_9_0_0(const C* pc, bool (C::*pm)() const) {
  return (pc->*pm)();
constexpr bool b = fails_9_0_0(&c, &C::f);

Clang 9 produces a diagnostic stating “constexpr function never produces a constant expression” for `fails_9_0_0`. Works in Clang 8 as well as GCC and MSVC.

— Michael Price

Sent from my iPhone

More information about the cfe-users mailing list