Skip to content

Commit

Permalink
[Headers] Don't declare unreachable() from stddef.h in C++ (#86748)
Browse files Browse the repository at this point in the history
Even if __need_unreachable is set, stddef.h should not declare
unreachable() in C++ because it conflicts with the declaration in
\<utility>.
  • Loading branch information
ian-twilightcoder committed Apr 4, 2024
1 parent dfaa144 commit df69a30
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang/lib/Headers/__stddef_unreachable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*===-----------------------------------------------------------------------===
*/

#ifndef __cplusplus

/*
* When -fbuiltin-headers-in-system-modules is set this is a non-modular header
* and needs to behave as if it was textual.
Expand All @@ -15,3 +17,5 @@
(__has_feature(modules) && !__building_module(_Builtin_stddef))
#define unreachable() __builtin_unreachable()
#endif

#endif

0 comments on commit df69a30

Please sign in to comment.