summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2022-06-13 14:49:08 (GMT)
committerGitHub <noreply@github.com>2022-06-13 14:49:08 (GMT)
commit65ff27c7d30b84655bf8caf6e396c65485708148 (patch)
tree48fa42e4d45546235f203425c69691add752fe8d /Include
parent259dd71c32a42708a2800c72898e2664a33fda9c (diff)
downloadcpython-65ff27c7d30b84655bf8caf6e396c65485708148.zip
cpython-65ff27c7d30b84655bf8caf6e396c65485708148.tar.gz
cpython-65ff27c7d30b84655bf8caf6e396c65485708148.tar.bz2
gh-91731: Don't define 'static_assert' in C++11 where is a keyword to avoid UB (GH-93700)
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 0a2c342..e37cda4 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