https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82047

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Because std::complex has a default constructor that initializes all its
members. If you replace S with a type that leaves some members uninitialized
when default-initialized, it fails:

template<typename T> struct S {};
template<typename T> constexpr T v;
constexpr auto c = v<S<void>>;      // ok
struct init { int i = 0; };
constexpr auto ok = v<init>;        // ok
struct no_init { int i; };
constexpr auto fails = v<no_init>;  // error

This is consistent with:

constexpr init x;      // ok
constexpr no_init y;   // error
constexpr no_init z{}; // ok

Reply via email to