git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e1d1eb)
Fix StaticAssertExpr() under C++
2018年2月19日 03:20:54 +0000 (22:20 -0500)
2018年2月19日 03:28:11 +0000 (22:28 -0500)
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.


diff --git a/src/include/c.h b/src/include/c.h
index 6b55181e0a1eae0f9b19d327264f6c5e1aaadfe4..37c0c3919902a48a542a05a8452fdd8ce4abbb82 100644 (file)
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -791,7 +791,7 @@ extern void ExceptionalCondition(const char *conditionName,
#define StaticAssertStmt(condition, errmessage) \
static_assert(condition, errmessage)
#define StaticAssertExpr(condition, errmessage) \
- StaticAssertStmt(condition, errmessage)
+ ({ static_assert(condition, errmessage); })
#else
#define StaticAssertStmt(condition, errmessage) \
do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /