Skip to content

Commit b7857c2

Browse files
committed
[clang] Define ATOMIC_FLAG_INIT correctly for C++.
1 parent 690ecee commit b7857c2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ Bug Fixes in This Version
750750

751751
- Fixed `static_cast` to array of unknown bound. Fixes (#GH62863).
752752

753+
- Fixed the definition of ATOMIC_FLAG_INIT in stdatomic.h so it can be used in C++.
754+
753755
Bug Fixes to Compiler Builtins
754756
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
755757

clang/lib/Headers/stdatomic.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ typedef _Atomic(uintmax_t) atomic_uintmax_t;
166166

167167
typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
168168

169+
#ifdef __cplusplus
170+
#define ATOMIC_FLAG_INIT {false}
171+
#else
169172
#define ATOMIC_FLAG_INIT { 0 }
173+
#endif
170174

171175
/* These should be provided by the libc implementation. */
172176
#ifdef __cplusplus

0 commit comments

Comments
 (0)