Skip to content

Commit

Permalink
Remove warnings on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoemi09 authored and Wentzell committed Sep 26, 2024
1 parent 8bb09be commit 8590b00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions c++/nda/basic_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValueType>)
if constexpr (nda::is_complex_v<ValueType>) {
auto static dist = std::uniform_real_distribution<typename ValueType::value_type>(0.0, 1.0);
for (auto &x : res) x = dist(gen) + 1i * dist(gen);
else
} else {
auto static dist = std::uniform_real_distribution<ValueType>(0.0, 1.0);
for (auto &x : res) x = dist(gen);
}
return res;
}

Expand Down
4 changes: 4 additions & 0 deletions test/c++/nda_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 8590b00

Please sign in to comment.