Skip to content

Commit

Permalink
[Headers] Don't declare unreachable() from stddef.h in C++
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 Mar 26, 2024
1 parent 36713a4 commit bfa1640
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 bfa1640

Please sign in to comment.