Skip to content

Commit 20f59a8

Browse files
git apple-llvm automergerian-twilightcoder
authored andcommitted
[cherry-pick swift/release/6.0][Headers] Don't declare unreachable() from stddef.h in C++
Even if __need_unreachable is set, stddef.h should not declare unreachable() in C++ because it conflicts with the declaration in <utility>. rdar://125937171 (cherry picked from commit d23b918)
1 parent 2ff2ebe commit 20f59a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/lib/Headers/__stddef_unreachable.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*===-----------------------------------------------------------------------===
88
*/
99

10+
#ifndef __cplusplus
11+
1012
/*
1113
* When -fbuiltin-headers-in-system-modules is set this is a non-modular header
1214
* and needs to behave as if it was textual.
@@ -15,3 +17,5 @@
1517
(__has_feature(modules) && !__building_module(_Builtin_stddef))
1618
#define unreachable() __builtin_unreachable()
1719
#endif
20+
21+
#endif

0 commit comments

Comments
 (0)