From 61479788b8dc95440ab0fb76a7b7bbc9e7931de2 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 16 Dec 2021 05:25:03 +0200 Subject: [PATCH] Additional Clang warning fixes --- test/function_n_test.cpp | 6 ++++-- test/function_test.cpp | 6 ++++-- test/mem_fun_cxx98.cpp | 2 +- test/mem_fun_portable.cpp | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/test/function_n_test.cpp b/test/function_n_test.cpp index 48fefc3..7fcf3f2 100644 --- a/test/function_n_test.cpp +++ b/test/function_n_test.cpp @@ -7,8 +7,10 @@ // For more information, see http://www.boost.org -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wself-assign-overloaded" +#if defined(__clang__) && defined(__has_warning) +# if __has_warning( "-Wself-assign-overloaded" ) +# pragma clang diagnostic ignored "-Wself-assign-overloaded" +# endif #endif #include diff --git a/test/function_test.cpp b/test/function_test.cpp index f6b7301..7592837 100644 --- a/test/function_test.cpp +++ b/test/function_test.cpp @@ -7,8 +7,10 @@ // For more information, see http://www.boost.org -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wself-assign-overloaded" +#if defined(__clang__) && defined(__has_warning) +# if __has_warning( "-Wself-assign-overloaded" ) +# pragma clang diagnostic ignored "-Wself-assign-overloaded" +# endif #endif #include diff --git a/test/mem_fun_cxx98.cpp b/test/mem_fun_cxx98.cpp index 9274036..b42cc00 100644 --- a/test/mem_fun_cxx98.cpp +++ b/test/mem_fun_cxx98.cpp @@ -16,7 +16,7 @@ struct Y { Y(int y = 0) : y_(y) {} - bool operator==(const Y& rhs) { return y_ == rhs.y_; } + bool operator==(const Y& rhs) const { return y_ == rhs.y_; } private: int y_; }; diff --git a/test/mem_fun_portable.cpp b/test/mem_fun_portable.cpp index e12fd08..0cf1ed4 100644 --- a/test/mem_fun_portable.cpp +++ b/test/mem_fun_portable.cpp @@ -16,7 +16,7 @@ struct Y { Y(int y = 0) : y_(y) {} - bool operator==(const Y& rhs) { return y_ == rhs.y_; } + bool operator==(const Y& rhs) const { return y_ == rhs.y_; } private: int y_; };