@@ -182,10 +182,7 @@ namespace Catch {
182182 // the desired semantics on GCC, but not on MSVC).
183183
184184 // This is used for the "if" part of CHECKED_IF/CHECKED_ELSE
185- static bool & g_lastAssertionPassed () {
186- static CATCH_INTERNAL_THREAD_LOCAL bool value = false ;
187- return value;
188- }
185+ static CATCH_INTERNAL_THREAD_LOCAL bool g_lastAssertionPassed = false ;
189186
190187 // This is the source location for last encountered macro. It is
191188 // used to provide the users with more precise location of error
@@ -345,12 +342,12 @@ namespace Catch {
345342 Detail::g_lastKnownLineInfo () = result.m_info .lineInfo ;
346343 if (result.getResultType () == ResultWas::Ok) {
347344 m_atomicAssertionCount.passed ++;
348- Detail::g_lastAssertionPassed () = true ;
345+ Detail::g_lastAssertionPassed = true ;
349346 } else if (result.getResultType () == ResultWas::ExplicitSkip) {
350347 m_atomicAssertionCount.skipped ++;
351- Detail::g_lastAssertionPassed () = true ;
348+ Detail::g_lastAssertionPassed = true ;
352349 } else if (!result.succeeded ()) {
353- Detail::g_lastAssertionPassed () = false ;
350+ Detail::g_lastAssertionPassed = false ;
354351 if (result.isOk ()) {
355352 }
356353 else if ( m_activeTestCase->getTestCaseInfo ().okToFail () ) // Read from a shared state established before the threads could start, this is fine
@@ -359,7 +356,7 @@ namespace Catch {
359356 m_atomicAssertionCount.failed ++;
360357 }
361358 else {
362- Detail::g_lastAssertionPassed () = true ;
359+ Detail::g_lastAssertionPassed = true ;
363360 }
364361
365362 if ( Detail::g_clearMessageScopes () ) {
@@ -603,14 +600,14 @@ namespace Catch {
603600 }
604601
605602 bool RunContext::lastAssertionPassed () {
606- return Detail::g_lastAssertionPassed () ;
603+ return Detail::g_lastAssertionPassed;
607604 }
608605
609606 void RunContext::assertionPassedFastPath (SourceLineInfo lineInfo) {
610607 // We want to save the line info for better experience with unexpected assertions
611608 Detail::g_lastKnownLineInfo () = lineInfo;
612609 ++m_atomicAssertionCount.passed ;
613- Detail::g_lastAssertionPassed () = true ;
610+ Detail::g_lastAssertionPassed = true ;
614611 Detail::g_clearMessageScopes () = true ;
615612 }
616613
0 commit comments