diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-04-13 16:55:37 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-04-13 17:54:03 +0100 |
commit | 474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b (patch) | |
tree | 9bdf83df1a34e04b7eea94f862f8af414c1fb526 | |
parent | 8913b2c2bcded39427ff27e6dfc276ae8555f6b8 (diff) | |
download | gcc-474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b.zip gcc-474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b.tar.gz gcc-474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b.tar.bz2 |
libstdc++: Fix <bit> to work freestanding [PR 100060]
libstdc++-v3/ChangeLog:
PR libstdc++/100060
* include/std/bit: Only include <ext/numeric_traits.h> for
hosted build, use <limits> otherwise.
-rw-r--r-- | libstdc++-v3/include/std/bit | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index fb78578..c5aae8b 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -34,7 +34,23 @@ #if __cplusplus >= 201402L #include <type_traits> -#include <ext/numeric_traits.h> + +#if _GLIBCXX_HOSTED +# include <ext/numeric_traits.h> +#else +# include <limits> +/// @cond undocumented +namespace __gnu_cxx +{ + template<typename _Tp> + struct __int_traits + { + static constexpr int __digits = std::numeric_limits<_Tp>::digits; + static constexpr _Tp __max = std::numeric_limits<_Tp>::max(); + }; +} +/// @endcond +#endif namespace std _GLIBCXX_VISIBILITY(default) { |