Skip to content

dev: change StaticAssert::assert() to ::s_assert()

Gold Star requested to merge (removed):static_assert into main

I struggled with this one for a bit but rather than disable the assert() macro which might be used elsewhere, I believe it's best to just not use assert as the function name.

When compiling for windows, assert is a macro that requires a scalar expression, The assert() macro can be disabled with /DNDEBUG or #define NDEBUG but I think it will be cleaner to not have any overlap here. The error is:

   [ 99/224] | win_x86_debug | bblocks32 | cxx | ['bblocks.cpp'] | ['bblocks.cpp.1.o']
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(49): error C2220: warning treated as error - no 'object' file generated
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(49): warning C4003: not enough actual parameters for macro 'assert'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(49): error C2059: syntax error: ')'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(49): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(50): error C2143: syntax error: missing ')' before ';'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(50): error C2059: syntax error: ')'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(50): error C2238: unexpected token(s) preceding ';'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(482): error C2864: 'StaticAssert<true>::stopping': a static data member with an in-class initializer must have non-volatile const integral type
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(482): note: type is 'INT'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(528): warning C4003: not enough actual parameters for macro 'assert'
   c:\users\user\desktop\protocol-fuzzer-ce\core\basicblocks\bblocks.cpp(562): fatal error C1004: unexpected end-of-file found
Edited by Gold Star

Merge request reports