Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7456109

Browse files
gh-91731: Don't define 'static_assert' in C++11 where is a keyword to avoid UB (GH-93700)
(cherry picked from commit65ff27c)Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent0c49a09 commit7456109

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

‎Include/pymacro.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
// static_assert is defined in glibc from version 2.16. Before it requires
1414
// compiler support (gcc >= 4.6) and is called _Static_assert.
15+
// In C++ 11 static_assert is a keyword, redefining is undefined behaviour.
1516
#if (defined(__GLIBC__) \
1617
&& (__GLIBC__ <2 || (__GLIBC__ ==2 && __GLIBC_MINOR__ <=16)) \
18+
&& !(defined(__cplusplus) && __cplusplus >=201103L) \
1719
&& !defined(static_assert))
1820
#definestatic_assert_Static_assert
1921
#endif
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Avoid defining the ``static_assert`` when compiling with C++ 11, where this
2+
is a keyword and redefining it can lead to undefined behavior. Patch by
3+
Pablo Galindo

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp