summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-16 14:50:15 (GMT)
committerGitHub <noreply@github.com>2022-06-16 14:50:15 (GMT)
commit74561095d906c2ca8ca8f41f22cb23a9e5b58954 (patch)
tree5fc6e4ddd0a4ee96906445a72655165887db0322 /Include
parent0c49a09e67407f810ace5e13399a6aa633fbadb7 (diff)
downloadcpython-74561095d906c2ca8ca8f41f22cb23a9e5b58954.zip
cpython-74561095d906c2ca8ca8f41f22cb23a9e5b58954.tar.gz
cpython-74561095d906c2ca8ca8f41f22cb23a9e5b58954.tar.bz2
gh-91731: Don't define 'static_assert' in C++11 where is a keyword to avoid UB (GH-93700)
(cherry picked from commit 65ff27c7d30b84655bf8caf6e396c65485708148) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Include')
-rw-r--r--Include/pymacro.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Include/pymacro.h b/Include/pymacro.h
index b959eeb..90ad8f0 100644
--- a/Include/pymacro.h
+++ b/Include/pymacro.h
@@ -12,8 +12,10 @@
// static_assert is defined in glibc from version 2.16. Before it requires
// compiler support (gcc >= 4.6) and is called _Static_assert.
+// In C++ 11 static_assert is a keyword, redefining is undefined behaviour.
#if (defined(__GLIBC__) \
&& (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) \
+ && !(defined(__cplusplus) && __cplusplus >= 201103L) \
&& !defined(static_assert))
# define static_assert _Static_assert
#endif