From 8590b006788282815054a89912e805caa33bb43f Mon Sep 17 00:00:00 2001 From: Thomas Hahn Date: Mon, 12 Aug 2024 10:46:14 -0400 Subject: [PATCH] Remove warnings on macOS --- c++/nda/basic_array.hpp | 8 +++++--- test/c++/nda_mem.cpp | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/c++/nda/basic_array.hpp b/c++/nda/basic_array.hpp index 9b275e49..90ec234f 100644 --- a/c++/nda/basic_array.hpp +++ b/c++/nda/basic_array.hpp @@ -465,12 +465,14 @@ namespace nda { { using namespace std::complex_literals; auto static gen = std::mt19937(std::random_device{}()); - auto static dist = std::uniform_real_distribution<>(0.0, 1.0); auto res = basic_array{shape}; - if constexpr (nda::is_complex_v) + if constexpr (nda::is_complex_v) { + auto static dist = std::uniform_real_distribution(0.0, 1.0); for (auto &x : res) x = dist(gen) + 1i * dist(gen); - else + } else { + auto static dist = std::uniform_real_distribution(0.0, 1.0); for (auto &x : res) x = dist(gen); + } return res; } diff --git a/test/c++/nda_mem.cpp b/test/c++/nda_mem.cpp index a9e6391c..e4d163e6 100644 --- a/test/c++/nda_mem.cpp +++ b/test/c++/nda_mem.cpp @@ -112,10 +112,14 @@ H check_handle() { // check copy operations H copy1(handle), copy2{}; copy2 = handle; +#ifdef __clang__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-assign-overloaded" +#endif // __clang__ handle = handle; // NOLINT (we want to check self assignment) +#ifdef __clang__ #pragma GCC diagnostic pop +#endif // __clang__ EXPECT_EQ(handle.size(), size); EXPECT_EQ(handle.size(), copy1.size()); EXPECT_EQ(handle.size(), copy2.size());