summaryrefslogtreecommitdiffstats
path: root/googlemock/include
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-01-17 20:56:41 (GMT)
committerGennadiy Civil <misterg@google.com>2019-01-18 19:06:03 (GMT)
commit9518a57428ae0a7ed450c1361768e84a2a38af5a (patch)
tree7e50bf47b6258b000a67e8882075f4743d072917 /googlemock/include
parent0adeadd2830211f827fd2908e4621f6a4afa810c (diff)
downloadgoogletest-9518a57428ae0a7ed450c1361768e84a2a38af5a.zip
googletest-9518a57428ae0a7ed450c1361768e84a2a38af5a.tar.gz
googletest-9518a57428ae0a7ed450c1361768e84a2a38af5a.tar.bz2
Googletest export
Fix mocking method arguments with templated copy constructors. A previous change removed workarounds for old compilers from googletest and googlemock. Unfortunately, a bit of code that started as a workaround for Symbian's C++ compiler is still needed to avoid copy/move constructor ambiguity when mocking functions with certain argument types. The test case added by this CL is extracted from Chrome's codebase, and was discovered while attempting to roll googletest. PiperOrigin-RevId: 229801765
Diffstat (limited to 'googlemock/include')
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index 526fe7a..9a81cfb 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -300,7 +300,10 @@ class OnCallSpec : public UntypedOnCallSpecBase {
const ArgumentMatcherTuple& matchers)
: UntypedOnCallSpecBase(a_file, a_line),
matchers_(matchers),
- extra_matcher_(_) {}
+ // By default, extra_matcher_ should match anything. However,
+ // we cannot initialize it with _ as that causes ambiguity between
+ // Matcher's copy and move constructor for some argument types.
+ extra_matcher_(A<const ArgumentTuple&>()) {}
// Implements the .With() clause.
OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) {
@@ -890,7 +893,10 @@ class TypedExpectation : public ExpectationBase {
: ExpectationBase(a_file, a_line, a_source_text),
owner_(owner),
matchers_(m),
- extra_matcher_(_),
+ // By default, extra_matcher_ should match anything. However,
+ // we cannot initialize it with _ as that causes ambiguity between
+ // Matcher's copy and move constructor for some argument types.
+ extra_matcher_(A<const ArgumentTuple&>()),
repeated_action_(DoDefault()) {}
~TypedExpectation() override {