summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock
diff options
context:
space:
mode:
authorDino Radakovic <dinor@google.com>2023-10-23 17:10:45 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-10-23 17:11:36 (GMT)
commit518387203b573f35477fa6872dd54620e70d2bdb (patch)
tree1467fb70814f5e312352febca9e4c49bd7d7186b /googlemock/include/gmock
parent116b7e55281c4200151524b093ecc03757a4ffda (diff)
downloadgoogletest-518387203b573f35477fa6872dd54620e70d2bdb.zip
googletest-518387203b573f35477fa6872dd54620e70d2bdb.tar.gz
googletest-518387203b573f35477fa6872dd54620e70d2bdb.tar.bz2
StartsWith: Explicitly construct matcher-typed strings from matchee parameterrefs/pull/4398/head
The current implementation breaks for absl::string_view on gcc, c++14: https://godbolt.org/z/Tzd3q1fqx Closes #4391 PiperOrigin-RevId: 575853981 Change-Id: I7b782598add480eb69d4ca27ea4a4bf5f758f6a3
Diffstat (limited to 'googlemock/include/gmock')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 0f67713..8052c74 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -1048,7 +1048,7 @@ class StartsWithMatcher {
template <typename MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
- const StringType& s2(s);
+ const StringType s2(s);
return s2.length() >= prefix_.length() &&
s2.substr(0, prefix_.length()) == prefix_;
}
@@ -1102,7 +1102,7 @@ class EndsWithMatcher {
template <typename MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
- const StringType& s2(s);
+ const StringType s2(s);
return s2.length() >= suffix_.length() &&
s2.substr(s2.length() - suffix_.length()) == suffix_;
}