public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/99995] New: [11 Regression] FAIL: 17_intro/headers/c++1998/49745.cc with -std=gnu++20
@ 2021-04-09 13:25 redi at gcc dot gnu.org
  2021-04-12  7:41 ` [Bug libstdc++/99995] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-09 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99995
           Summary: [11 Regression] FAIL:
                    17_intro/headers/c++1998/49745.cc with -std=gnu++20
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

In C++20 mode <memory> includes <bits/atomic_wait.h> which includes <unistd.h>
for SYS_futex, and that means that POSIX truncate is declared, leading to:

In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/atomic_wait.h:44,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/atomic_base.h:41,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_atomic.h:33,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/memory:78,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/powerpc64le-unknown-linux-gnu/bits/stdc++.h:82,
                 from <command-line>:
/usr/include/unistd.h:1015: note: previous declaration 'int truncate(const
char*, __off_t)'
compiler exited with status 1
FAIL: 17_intro/headers/c++1998/49745.cc (test for excess errors)
Excess errors:
/home/jwakely/src/gcc/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc:22:
error: 'int truncate' redeclared as different kind of entity

This is only seen when adding -std=gnu++20 (or similar) to the test flags
explicitly, and only when PCH is enabled so that -include bits/stdc++.h is
added to the test flags, because otherwise that test doesn't include <memory>.
But the underlying problem is that including <unistd.h> means Bug 49745 has
returned: we include <unistd.h> from C++ library headers.

This is only an issue for C++20 mode, and will fix itself when the code to use
futexes moves into libstdc++.so rather than being in headers.

In the meantime, we might want to XFAIL that test for c++20 mode.

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

end of thread, other threads:[~2023-05-08 12:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 13:25 [Bug libstdc++/99995] New: [11 Regression] FAIL: 17_intro/headers/c++1998/49745.cc with -std=gnu++20 redi at gcc dot gnu.org
2021-04-12  7:41 ` [Bug libstdc++/99995] " rguenth at gcc dot gnu.org
2021-04-12 10:35 ` cvs-commit at gcc dot gnu.org
2021-04-12 10:37 ` [Bug libstdc++/99995] [11 Regression] should not include <unistd.h> in c++20 mode redi at gcc dot gnu.org
2021-04-21 12:06 ` [Bug libstdc++/99995] [11/12 " redi at gcc dot gnu.org
2022-05-06  8:30 ` [Bug libstdc++/99995] [11/12/13 " jakub at gcc dot gnu.org
2023-05-08 12:21 ` [Bug libstdc++/99995] [11/12/13/14 " rguenth 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).