-- Suppress -Winvalid-specialization for the std::is_pod, std::is_floating_point, -- std::is_signed, and std::is_unsigned specializations. Clang 17+ treats user -- specializations of these standard library type traits as an error. Wrap them -- in pragma diagnostic push/pop to preserve the intended behavior while -- suppressing the diagnostic. --- paddle/phi/common/complex.h.orig 2026-09-09 02:40:49 UTC +++ paddle/phi/common/complex.h @@ -685,6 +685,14 @@ namespace std { namespace std { +// Clang 17+ disallows specialization of is_pod, is_floating_point, is_signed, +// and is_unsigned. Suppress the diagnostic for these PaddlePaddle-specific +// specializations. +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winvalid-specialization" +#endif + template struct is_pod> { static const bool value = true; @@ -703,6 +711,10 @@ struct is_unsigned> { struct is_unsigned> { static const bool value = false; }; + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif template inline bool isnan(const phi::dtype::complex& a) {