From 678c1c73de2cf004d58f5dbbef299083997d924a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 7 Mar 2023 15:34:10 -0800 Subject: Fix compilation of googletest-printers-test.cc when using -Wundef #3267 PiperOrigin-RevId: 514858420 Change-Id: Ic712aafad25f5e63ae48f647557de95cef890978 --- googletest/test/googletest-printers-test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index fa8b084..5fdc086 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -1796,7 +1796,8 @@ TEST(UniversalPrintTest, SmartPointers) { std::shared_ptr p3(new int(1979)); EXPECT_EQ("(ptr = " + PrintPointer(p3.get()) + ", value = 1979)", PrintToString(p3)); -#if __cpp_lib_shared_ptr_arrays >= 201611L +#if defined(__cpp_lib_shared_ptr_arrays) && \ + (__cpp_lib_shared_ptr_arrays >= 201611L) std::shared_ptr p4(new int[2]); EXPECT_EQ("(" + PrintPointer(p4.get()) + ")", PrintToString(p4)); #endif @@ -1815,7 +1816,8 @@ TEST(UniversalPrintTest, SmartPointers) { EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr())); EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr())); EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr())); -#if __cpp_lib_shared_ptr_arrays >= 201611L +#if defined(__cpp_lib_shared_ptr_arrays) && \ + (__cpp_lib_shared_ptr_arrays >= 201611L) EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr())); EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr())); EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr())); -- cgit v0.12