summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorDino Radakovic <dinor@google.com>2022-08-04 17:53:26 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-08-04 17:53:57 (GMT)
commit5b909beeec178f338be997830b6c31a80cda7a93 (patch)
treec9b0e9ab6daac2af0409e45ef40fb1c3c6b9d7ca /googletest
parent6045bf2ade7d997373355ba147eb6dc74425deb5 (diff)
downloadgoogletest-5b909beeec178f338be997830b6c31a80cda7a93.zip
googletest-5b909beeec178f338be997830b6c31a80cda7a93.tar.gz
googletest-5b909beeec178f338be997830b6c31a80cda7a93.tar.bz2
Explicitly instantiate matchee std::string in MatchesRegex
If this ever turns out to be a performance issue, we could use std::conditional and std::is_same to avoid copying std::strings. Fixes #3949 PiperOrigin-RevId: 465353572 Change-Id: If2d691bccb626c692c87e006df5afe88a4ed1542
Diffstat (limited to 'googletest')
-rw-r--r--googletest/include/gtest/gtest-matchers.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index bffa00c..4a60b0d 100644
--- a/googletest/include/gtest/gtest-matchers.h
+++ b/googletest/include/gtest/gtest-matchers.h
@@ -842,7 +842,7 @@ class MatchesRegexMatcher {
template <class MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
- const std::string& s2(s);
+ const std::string s2(s);
return full_match_ ? RE::FullMatch(s2, *regex_)
: RE::PartialMatch(s2, *regex_);
}