public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/100060] New: [10/11 Regression] freestanding header <bit> includes non-freestanding <ext/numeric_limits.h>
Date: Tue, 13 Apr 2021 09:40:57 +0000	[thread overview]
Message-ID: <bug-100060-4@http.gcc.gnu.org/bugzilla/> (raw)

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)
 {

             reply	other threads:[~2021-04-13  9:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13  9:40 redi at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100060-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).