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

Richard Smith via cfe-users cfe-users at lists.llvm.org
Wed Oct 2 18:19:14 PDT 2019


On Tue, 1 Oct 2019 at 10:42, Michael Price - Dev via cfe-users <
cfe-users at lists.llvm.org> wrote:

> 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.


> — Michael Price
>
> Sent from my iPhone
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20191002/1b8dd2cb/attachment.html>


More information about the cfe-users mailing list