diff --git a/public/tier0/dbg.h b/public/tier0/dbg.h index 60eed9a6..37cc3655 100644 --- a/public/tier0/dbg.h +++ b/public/tier0/dbg.h @@ -315,13 +315,10 @@ PLATFORM_INTERFACE void COM_TimestampedLog( char const *fmt, ... ) FMTFUNCTION( //----------------------------------------------------------------------------- // Macro to assist in asserting constant invariants during compilation -#ifdef _DEBUG -#define COMPILE_TIME_ASSERT( pred ) switch(0){case 0:case pred:;} -#define ASSERT_INVARIANT( pred ) static void UNIQUE_ID() { COMPILE_TIME_ASSERT( pred ) } -#else -#define COMPILE_TIME_ASSERT( pred ) -#define ASSERT_INVARIANT( pred ) -#endif +#define COMPILE_TIME_ASSERT( pred ) static_assert( pred, "Compile time assert constraint is not true: " #pred ) +// ASSERT_INVARIANT used to be needed in order to allow COMPILE_TIME_ASSERTs at global +// scope. However the new COMPILE_TIME_ASSERT macro supports that by default. +#define ASSERT_INVARIANT( pred ) COMPILE_TIME_ASSERT( pred ) #ifdef _DEBUG template diff --git a/public/tier1/utlhashtable.h b/public/tier1/utlhashtable.h index c14a73b6..2704b36e 100644 --- a/public/tier1/utlhashtable.h +++ b/public/tier1/utlhashtable.h @@ -740,8 +740,8 @@ UtlHashHandle_t CUtlHashtable -void CUtlHashtable::DbgCheckIntegrity() const +template +void CUtlHashtable::DbgCheckIntegrity() const { // Stress test the hash table as a test of both container functionality // and also the validity of the user's Hash and Equal function objects.