From e39ea0e3c82727a2df61a47cda22637c7bfb5457 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 9 May 2020 01:42:14 +0100 Subject: regex_stdlib: Don't copy std::regex_error when catching it. --- src/modules/extra/m_regex_stdlib.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/extra/m_regex_stdlib.cpp b/src/modules/extra/m_regex_stdlib.cpp index 149ff3b38..b9602fe01 100644 --- a/src/modules/extra/m_regex_stdlib.cpp +++ b/src/modules/extra/m_regex_stdlib.cpp @@ -33,10 +33,11 @@ class StdRegex : public Regex public: StdRegex(const std::string& rx, std::regex::flag_type fltype) : Regex(rx) { - try{ + try + { regexcl.assign(rx, fltype | std::regex::optimize); } - catch(std::regex_error rxerr) + catch(const std::regex_error& rxerr) { throw RegexException(rx, rxerr.what()); } -- cgit v1.2.3