The following code compiles on GCC and MSVC but is rejected by Clang:
struct X
{
const void *p_;
consteval X()
: p_{this}
{
}
};
static constexpr X x{};
(https://godbolt.org/z/ExYMeTcTq)
Is Clang correct here? To add to my confusion, if the constructor of the class is marked constexpr
rather than consteval
, Clang happily accepts the code. I thought for functions consteval
implies constexpr
, am I wrong?