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
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to