From 0545de0a31c0691f978f858f3b5b875c6469fb35 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 17 Aug 2017 19:19:17 +0100 Subject: [PATCH] Hold translated exception in local string while matching --- include/internal/catch_capture_matchers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/internal/catch_capture_matchers.cpp b/include/internal/catch_capture_matchers.cpp index 8c30a154..758177e9 100644 --- a/include/internal/catch_capture_matchers.cpp +++ b/include/internal/catch_capture_matchers.cpp @@ -16,7 +16,8 @@ namespace Catch { // There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers // the Equals matcher (so the header does not mention matchers) void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { - MatchExpr expr( Catch::translateActiveException(), matcher, matcherString ); + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr expr( exceptionMessage, matcher, matcherString ); handler.handle( expr ); }