public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100060] New: [10/11 Regression] freestanding header <bit> includes non-freestanding <ext/numeric_limits.h>
@ 2021-04-13  9:40 redi at gcc dot gnu.org
  2021-04-13  9:41 ` [Bug libstdc++/100060] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-13  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100060

            Bug ID: 100060
           Summary: [10/11 Regression] freestanding header <bit> includes
                    non-freestanding <ext/numeric_limits.h>
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

As shown in Bug 100057 comment 16:

d:\cross_toolchains\x86_64-elf\x86_64-elf\include\c++\11.0.1\bit:37:10: fatal
error: ext/numeric_traits.h: No such file or directory
   37 | #include <ext/numeric_traits.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

#include<bit>


We could either install that header for freestanding, or just use <limits> for
freestanding:

--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -34,7 +34,22 @@
 #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)
 {

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-13 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13  9:40 [Bug libstdc++/100060] New: [10/11 Regression] freestanding header <bit> includes non-freestanding <ext/numeric_limits.h> redi at gcc dot gnu.org
2021-04-13  9:41 ` [Bug libstdc++/100060] " redi at gcc dot gnu.org
2021-04-13  9:42 ` redi at gcc dot gnu.org
2021-04-13 16:54 ` cvs-commit at gcc dot gnu.org
2021-04-13 17:52 ` cvs-commit at gcc dot gnu.org
2021-04-13 17:52 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).