From 447c2cd3d6884b8383884dbbfe65db845ea5c04d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 20 Nov 2017 21:56:37 +0000 Subject: Remove invalid use of null references (undefined behaviour) Enable the relevant compiler warning as an error, if supported (-Werror=undefined-bool-conversion). http://www.gotw.ca/conv/002.htm http://stackoverflow.com/questions/2165078/a-reference-can-not-be-null-or-it-can-be-null (cherry picked from commit f2911acac0c8375a08ecc0a55f853a5a59c4d511) (cherry picked from commit 5a50b98401302a5ba89366e4c0f8cccdd88d8722) --- test/common/testcommon.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/common/testcommon.cpp') diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp index bd75ac37..3de7da1d 100644 --- a/test/common/testcommon.cpp +++ b/test/common/testcommon.cpp @@ -312,10 +312,11 @@ int test(int argc, const char *argv[]) // Check that using timer methods without initialisation // throws an assertion failure. Can only do this in debug mode #ifndef BOX_RELEASE_BUILD - TEST_CHECK_THROWS(Timers::Add(*(Timer*)NULL), - CommonException, AssertFailed); - TEST_CHECK_THROWS(Timers::Remove(*(Timer*)NULL), - CommonException, AssertFailed); + { + Timer tim(0, "tim"); + TEST_CHECK_THROWS(Timers::Add(tim), CommonException, AssertFailed); + Timers::Remove(tim); + } #endif // TEST_CHECK_THROWS(Timers::Signal(), CommonException, AssertFailed); -- cgit v1.2.3