#include <complex>
struct S
{
static std::complex<double> constexpr c;
};
gcc generates an error because an initializer is missing. Clang and MSVC do not generate an error.
As far as I know a constexpr static data member must have an initializer, even if it is of class type that has a constructor that can be called without arguments (as in this case). Unfortunately I don't have the latest C++ standard to back up my assumption.
So the correct code should initialize with a constructor, for instance:
struct S
{
static std::complex<double> constexpr c {};
};
Can anyone prove which compiler is right and which is wrong?