From 252dd1e9f0b2b5c013ebe6d6df103e7508ffff4e Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Thu, 20 Feb 2025 15:14:58 +0100 Subject: [PATCH] Building ext/intl fails with MSVC /std:c11 (#17179) A previous fix to be able to build C++ extensions with MSVC[1], was based on the assumption that `max_align_t` would be defined in stddef.h on Windows. That was plain wrong; there is no such typedef (or macro). Thus we revert that fix, and instead make an exception for Windows, where we always use the fallback definition, which should work fine on Windows. [1] --- Zend/zend_portability.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index f5e0b15788ecc..3b2278d545637 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -789,13 +789,9 @@ extern "C++" { # define ZEND_STATIC_ASSERT(c, m) #endif -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) /* C11 */ +#if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) /* C11 */ \ + || (defined(__cplusplus) && __cplusplus >= 201103L) /* C++11 */) && !defined(ZEND_WIN32) typedef max_align_t zend_max_align_t; -#elif (defined(__cplusplus) && __cplusplus >= 201103L) /* C++11 */ -extern "C++" { -# include -} -typedef std::max_align_t zend_max_align_t; #else typedef union { char c;