summaryrefslogtreecommitdiffstats
path: root/googletest/test/googletest-printers-test.cc
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@google.com>2023-03-07 23:34:10 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-03-07 23:34:41 (GMT)
commit678c1c73de2cf004d58f5dbbef299083997d924a (patch)
tree9fdbe7a23b141193df0a7543ea6a768e7883e60b /googletest/test/googletest-printers-test.cc
parentcf4f4400db41a70b87df127aee20fe802dae5520 (diff)
downloadgoogletest-678c1c73de2cf004d58f5dbbef299083997d924a.zip
googletest-678c1c73de2cf004d58f5dbbef299083997d924a.tar.gz
googletest-678c1c73de2cf004d58f5dbbef299083997d924a.tar.bz2
Fix compilation of googletest-printers-test.cc when using -Wundef
#3267 PiperOrigin-RevId: 514858420 Change-Id: Ic712aafad25f5e63ae48f647557de95cef890978
Diffstat (limited to 'googletest/test/googletest-printers-test.cc')
-rw-r--r--googletest/test/googletest-printers-test.cc6
1 files 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<int> 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<int[]> 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<const int>()));
EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr<volatile int>()));
EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr<volatile const int>()));
-#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<int[]>()));
EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr<const int[]>()));
EXPECT_EQ("(nullptr)", PrintToString(std::shared_ptr<volatile int[]>()));