diff options
author | Billy Donahue <billydonahue@google.com> | 2015-09-07 22:32:56 -0400 |
---|---|---|
committer | Billy Donahue <billydonahue@google.com> | 2015-09-07 22:32:56 -0400 |
commit | f19b060075e89ac7ccd1744b30d41b755b92a10a (patch) | |
tree | ae0c43fb177e949b18a042ea7102d05e688c164a /googlemock/test/gmock-generated-actions_test.cc | |
parent | 99166db7545b56e0e34e1ce39932a1d411169b18 (diff) | |
download | googletest-f19b060075e89ac7ccd1744b30d41b755b92a10a.tar.gz googletest-f19b060075e89ac7ccd1744b30d41b755b92a10a.zip |
Googlemock has some tuples containing lvalue refs in its unit tests.
These tuples are created with make_tuple, which is given temporaries.
The make_tuple is in a function argument list.
A possibly overzealous static_assert in libc++'s std::tuple ctor
is firing in our 'Perform(make_tuple("hi"))' calls, so
we can't use its make_tuple here. Instead we will use
explicitly-constructed tuples constructed from non-temporary strings.
Workaround for llvm bug:
https://llvm.org/bugs/show_bug.cgi?id=20855
An alternative to https://github.com/google/googletest/pull/580 .
Diffstat (limited to 'googlemock/test/gmock-generated-actions_test.cc')
-rw-r--r-- | googlemock/test/gmock-generated-actions_test.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/googlemock/test/gmock-generated-actions_test.cc b/googlemock/test/gmock-generated-actions_test.cc index c2d2a0a8..5ca5bc78 100644 --- a/googlemock/test/gmock-generated-actions_test.cc +++ b/googlemock/test/gmock-generated-actions_test.cc @@ -376,7 +376,8 @@ class SubstractAction : public ActionInterface<int(int, int)> { // NOLINT TEST(WithArgsTest, NonInvokeAction) { Action<int(const string&, int, int)> a = // NOLINT WithArgs<2, 1>(MakeAction(new SubstractAction)); - EXPECT_EQ(8, a.Perform(make_tuple(string("hi"), 2, 10))); + string s("hello"); + EXPECT_EQ(8, a.Perform(tuple<const string&, int, int>(s, 2, 10))); } // Tests using WithArgs to pass all original arguments in the original order. @@ -753,7 +754,7 @@ TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) { TEST(ActionPMacroTest, WorksInCompatibleMockFunction) { Action<std::string(const std::string& s)> a1 = Plus("tail"); const std::string re = "re"; - EXPECT_EQ("retail", a1.Perform(make_tuple(re))); + EXPECT_EQ("retail", a1.Perform(tuple<const std::string&>(re))); } // Tests that we can use ACTION*() to define actions overloaded on the @@ -795,7 +796,7 @@ TEST(ActionPnMacroTest, WorksFor3Parameters) { Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">"); const std::string re = "re"; - EXPECT_EQ("retail->", a2.Perform(make_tuple(re))); + EXPECT_EQ("retail->", a2.Perform(tuple<const std::string&>(re))); } ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; } |