From 9c616411bad8dadbc07b718e54f0ec4f0fe21f2a Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Wed, 6 Nov 2024 16:58:48 +1100 Subject: [PATCH] Fix C++20 compiler error when CESIUM_FORCE_ASSERTIONS is not defined. --- CesiumUtility/include/CesiumUtility/Assert.h | 4 +++- CesiumUtility/src/Assert.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CesiumUtility/include/CesiumUtility/Assert.h b/CesiumUtility/include/CesiumUtility/Assert.h index aeb9b32a8..a567d3e19 100644 --- a/CesiumUtility/include/CesiumUtility/Assert.h +++ b/CesiumUtility/include/CesiumUtility/Assert.h @@ -1,5 +1,7 @@ #pragma once +#include + // // Define our own assertion, so that users can forcebly turn them on if needed // @@ -7,7 +9,7 @@ // Asserts are defined in cassert and normally compiled out when NDEBUG is // defined. Redirect to our own assertion that can't be compiled out namespace CesiumUtility { -void forceAssertFailure(); +std::int32_t forceAssertFailure(); }; #define CESIUM_ASSERT(expression) \ ((expression) ? 0 : CesiumUtility::forceAssertFailure()) diff --git a/CesiumUtility/src/Assert.cpp b/CesiumUtility/src/Assert.cpp index c8e0f7356..07effd58b 100644 --- a/CesiumUtility/src/Assert.cpp +++ b/CesiumUtility/src/Assert.cpp @@ -7,7 +7,10 @@ #define NDEBUG namespace CesiumUtility { -void forceAssertFailure() { assert(0 && "Assertion failed"); } +std::int32_t forceAssertFailure() { + assert(0 && "Assertion failed"); + return 1; +} }; // namespace CesiumUtility #endif