What steps will reproduce the problem?
1. Compiler the program below by "CC runner.cpp gtest-all.cc"
#include "gtest/gtest.h"
#include <string>
TEST(String, POD) {
std::string a("x"), b("y");
EXPECT_EQ(a, b);
}
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
What is the expected output? What do you see instead?
It should not print out any compilation warnings. But it prints:
runner.cpp:
"runner.cpp", line 7: Warning: A non-POD object of type "std::string "
passed as a variable argument to function
"testing::internal::IsNullLiteralHelper(...)".
1 Warning(s) detected.
What version of the product are you using? On what operating system?
Google Test 1.4.0
uname -a
SunOS 5.10 Generic_127111-09 sun4u sparc SUNW,Sun-Fire
CC -V
CC: Sun C++ 5.9 SunOS_sparc Patch 124863-12 2009/04/21
Please provide any additional information below, such as a code snippet.
The patch belows fixes the problem:
diff --git a/gtest/gtest.h b/gtest/gtest.h
index 2e8d65a..21716b5 100644
--- a/gtest/gtest.h
+++ b/gtest/gtest.h
@@ -1842,7 +1842,7 @@ size_t GetThreadCount();
// Therefore Google Test is not thread-safe.
#define GTEST_IS_THREADSAFE 0
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
+#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
// Passing non-POD classes through ellipsis (...) crashes the ARM
// compiler. The Nokia Symbian and the IBM XL C/C++ compiler try to
Original issue reported on code.google.com by ade...@gmail.com on 7 Dec 2009 at 10:58
Original issue reported on code.google.com by
ade...@gmail.com
on 7 Dec 2009 at 10:58