diff options
author | Billy Donahue <billydonahue@google.com> | 2015-09-08 02:32:56 (GMT) |
---|---|---|
committer | Billy Donahue <billydonahue@google.com> | 2015-09-08 02:32:56 (GMT) |
commit | f19b060075e89ac7ccd1744b30d41b755b92a10a (patch) | |
tree | ae0c43fb177e949b18a042ea7102d05e688c164a /googlemock/test/gmock-more-actions_test.cc | |
parent | 99166db7545b56e0e34e1ce39932a1d411169b18 (diff) | |
download | googletest-f19b060075e89ac7ccd1744b30d41b755b92a10a.zip googletest-f19b060075e89ac7ccd1744b30d41b755b92a10a.tar.gz googletest-f19b060075e89ac7ccd1744b30d41b755b92a10a.tar.bz2 |
Googlemock has some tuples containing lvalue refs in its unit tests.refs/pull/583/head
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-more-actions_test.cc')
-rw-r--r-- | googlemock/test/gmock-more-actions_test.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/googlemock/test/gmock-more-actions_test.cc b/googlemock/test/gmock-more-actions_test.cc index 9477fe9..77e15bd 100644 --- a/googlemock/test/gmock-more-actions_test.cc +++ b/googlemock/test/gmock-more-actions_test.cc @@ -327,7 +327,9 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) { TEST(InvokeTest, FunctionWithUnusedParameters) { Action<int(int, int, double, const string&)> a1 = Invoke(SumOfFirst2); - EXPECT_EQ(12, a1.Perform(make_tuple(10, 2, 5.6, string("hi")))); + string s("hi"); + EXPECT_EQ(12, a1.Perform( + tuple<int, int, double, const string&>(10, 2, 5.6, s))); Action<int(int, int, bool, int*)> a2 = Invoke(SumOfFirst2); @@ -379,7 +381,8 @@ TEST(InvokeMethodTest, Binary) { Foo foo; Action<string(const string&, char)> a = Invoke(&foo, &Foo::Binary); string s("Hell"); - EXPECT_EQ("Hello", a.Perform(make_tuple(s, 'o'))); + EXPECT_EQ("Hello", a.Perform( + tuple<const string&, char>(s, 'o'))); } // Tests using Invoke() with a ternary method. |