courtneypresto / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Using death test asserts causes the warnings about RE::RE(const testing::internal::RE&) copy constructor #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile any test case using death test asserts (eq. EXPECT_EXIT()) on 
AIX

What is the expected output? What do you see instead?

The following warnings occur:

"Example_unittest.cpp", line 13.9: 1540-0306 (W) The "private" copy 
constructor "RE(const RE &)" cannot be accessed.
"Example_unittest.cpp", line 13.9: 1540-0308 (I) The semantics specify that 
a temporary object must be constructed.
"Example_unittest.cpp", line 13.9: 1540-0309 (I) The temporary is not 
constructed, but the copy constructor must be accessible.

What version of the product are you using? On what operating system?

gtest 1.3.0

uname -a
AIX 3 5

Compiler:

lslpp -L | grep cpp | grep core
vacpp.cmp.core            8.0.0.20    C     F    IBM XL C/C++ Compiler

Please provide any additional information below.

AIX C++ compiler needs the copy constructor for "const 
::testing::internal::RE& gtest_regex = (regex);". But the RE::RE() has the 
constructors from the std::string and "const char*" only. The patch below 
solves this problem:

==== gtest-1.3.0/include/gtest/internal/gtest-death-test-internal.h#1 - 
gtest-1.3.0/include/gtest/internal/gtest-death-test-internal.h ====
@@ -158,7 +158,7 @@
 #define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
   if (true) { \
-    const ::testing::internal::RE& gtest_regex = (regex); \
+    const ::testing::internal::RE gtest_regex(regex); \
     ::testing::internal::DeathTest* gtest_dt; \
     if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, 
\
         __FILE__, __LINE__, &gtest_dt)) { \

Original issue reported on code.google.com by ade...@gmail.com on 29 Jul 2009 at 3:00

GoogleCodeExporter commented 9 years ago

Original comment by zhanyong...@gmail.com on 16 Sep 2009 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by w...@google.com on 23 Mar 2010 at 7:28