In the following code struct A has immediate function default constructor, and an object of the struct is created in the dynamic memory be means of new A{}:
struct A {
consteval A() {}
};
int main() {
new A{};
}
Only Clang accepts it.
GCC complains
error: the value of '<anonymous>' is not usable in a constant expression
6 | new A{};
| ^
note: '<anonymous>' was not declared 'constexpr'
And MSVC does as well:
error C7595: 'A::A': call to immediate function is not a constant expression
Demo: https://gcc.godbolt.org/z/6Px5WYGzd
Which compiler is right here?