34 lines
1.2 KiB
C++
34 lines
1.2 KiB
C++
-- 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 <typename T>
|
|
struct is_pod<phi::dtype::complex<T>> {
|
|
static const bool value = true;
|
|
@@ -703,6 +711,10 @@ struct is_unsigned<phi::dtype::complex<T>> {
|
|
struct is_unsigned<phi::dtype::complex<T>> {
|
|
static const bool value = false;
|
|
};
|
|
+
|
|
+#if defined(__clang__)
|
|
+#pragma clang diagnostic pop
|
|
+#endif
|
|
|
|
template <typename T>
|
|
inline bool isnan(const phi::dtype::complex<T>& a) {
|