To clarify, is the following program well-formed?
#include <new>
char foo[32];
struct bar {
static constexpr int foobar = 42;
};
int main()
{
auto p = new (foo) bar();
static_assert(p->foobar == 42);
}
gcc and msvc accept, but clang rejects with the error
read of non-constexpr variable 'p' is not allowed in a constant expression
, who is right?
case p->foobar:
statement. – Coastward