From fa2366ba1260896a358e86fd3e51f2d4a66b5585 Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Thu, 20 Mar 2014 04:09:36 +0100 Subject: [PATCH] Fixed -Wunused-value warnings from Clang 3.4 in THROWS/NOTHROW use. These warnings were emitted by test suites that included any test cases for std::bad_cast exceptions being thrown or not thrown, as per the following example: REQUIRE_THROWS_AS((bool)my_object, std::bad_cast); --- include/internal/catch_capture.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 5055cddf..2896a7ab 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -106,7 +106,7 @@ struct TestFailureException{}; do { \ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, resultDisposition ); \ try { \ - expr; \ + static_cast(expr); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), resultDisposition, false ); \ } \ catch( ... ) { \ @@ -118,7 +118,7 @@ struct TestFailureException{}; #define INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, resultDisposition ) \ try { \ if( Catch::getCurrentContext().getConfig()->allowThrows() ) { \ - expr; \ + static_cast(expr); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::DidntThrowException ), resultDisposition, false ); \ } \ } \