diff --git a/src/include/c.h b/src/include/c.h index 82f8e9d4c7b..4b0f5138d83 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1245,7 +1245,10 @@ typedef union PGAlignedXLogBlock * Note that this only works in function scope, not for global variables (it'd * be nice, but not trivial, to improve that). */ -#if defined(HAVE__BUILTIN_TYPES_COMPATIBLE_P) +#if defined(__cplusplus) +#define unconstify(underlying_type, expr) const_cast(expr) +#define unvolatize(underlying_type, expr) const_cast(expr) +#elif defined(HAVE__BUILTIN_TYPES_COMPATIBLE_P) #define unconstify(underlying_type, expr) \ (StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), const underlying_type), \ "wrong cast"), \