Fix StaticAssertExpr() under C++
The previous code didn't compile, because static_assert() must end with a semicolon. To fix, wrap it in a block, similar to the C code.
This commit is contained in:
parent
2e1d1ebdff
commit
ebf6049ebe
@ -791,7 +791,7 @@ extern void ExceptionalCondition(const char *conditionName,
|
|||||||
#define StaticAssertStmt(condition, errmessage) \
|
#define StaticAssertStmt(condition, errmessage) \
|
||||||
static_assert(condition, errmessage)
|
static_assert(condition, errmessage)
|
||||||
#define StaticAssertExpr(condition, errmessage) \
|
#define StaticAssertExpr(condition, errmessage) \
|
||||||
StaticAssertStmt(condition, errmessage)
|
({ static_assert(condition, errmessage); })
|
||||||
#else
|
#else
|
||||||
#define StaticAssertStmt(condition, errmessage) \
|
#define StaticAssertStmt(condition, errmessage) \
|
||||||
do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0)
|
do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user