diff --git a/src/MagnumExternal/Optional/Test/StdOptionalTest.cpp b/src/MagnumExternal/Optional/Test/StdOptionalTest.cpp index ca4827cfe6..963367ef7b 100644 --- a/src/MagnumExternal/Optional/Test/StdOptionalTest.cpp +++ b/src/MagnumExternal/Optional/Test/StdOptionalTest.cpp @@ -23,6 +23,13 @@ DEALINGS IN THE SOFTWARE. */ +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#elif defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable: 4996) +#endif #include #include #include @@ -42,15 +49,7 @@ StdOptionalTest::StdOptionalTest() { addTests({&StdOptionalTest::conversion}); } -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif void StdOptionalTest::conversion() { - #ifdef _MSC_VER - #pragma warning(push) - #pragma warning(disable: 4996) - #endif Debug{} << "Using C++ version" << CORRADE_CXX_STANDARD; #ifdef _MAGNUM_HAS_STD_OPTIONAL Debug{} << "Using a conversion to std::optional, C++17 should be present"; @@ -73,14 +72,13 @@ void StdOptionalTest::conversion() { Containers::Optional> c{std::unique_ptr{new int{7}}}; std::optional> sc = std::move(c); CORRADE_COMPARE(**sc, 7); - #ifdef _MSC_VER - #pragma warning(pop) - #endif } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif }} CORRADE_TEST_MAIN(Magnum::Test::StdOptionalTest) +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#elif defined(_MSC_VER) +#pragma warning(pop) +#endif