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
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.
This was also filed as PR43519 and is now fixed in trunk.