[Bug libstdc++/99958] The <algorithm> seems to contain the entire <vector> and <string> in C++20 mode

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 7 20:00:42 GMT 2021


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This seems to work:

diff --git a/libstdc++-v3/include/pstl/glue_algorithm_defs.h
b/libstdc++-v3/include/pstl/glue_algorithm_defs.h
index 48bc56ae401..cef78e22e31 100644
--- a/libstdc++-v3/include/pstl/glue_algorithm_defs.h
+++ b/libstdc++-v3/include/pstl/glue_algorithm_defs.h
@@ -10,7 +10,7 @@
 #ifndef _PSTL_GLUE_ALGORITHM_DEFS_H
 #define _PSTL_GLUE_ALGORITHM_DEFS_H

-#include <functional>
+#include <bits/stl_pair.h>

 #include "execution_defs.h"

diff --git a/libstdc++-v3/include/pstl/utils.h
b/libstdc++-v3/include/pstl/utils.h
index 1711f292678..69d78c3ca0f 100644
--- a/libstdc++-v3/include/pstl/utils.h
+++ b/libstdc++-v3/include/pstl/utils.h
@@ -10,8 +10,9 @@
 #ifndef _PSTL_UTILS_H
 #define _PSTL_UTILS_H

+#include <exception>
 #include <new>
-#include <iterator>
+#include <type_traits>

 namespace __pstl
 {

The <pstl/utils.h> header only requires declarations of std::bad_alloc and
std::terminate(), but includes <exception> and <new> to get them. That could be
reduced with some minor surgery.


I'll test this too:

diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h
b/libstdc++-v3/include/bits/streambuf_iterator.h
index 22af3fd5995..a188db69b53 100644
--- a/libstdc++-v3/include/bits/streambuf_iterator.h
+++ b/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -32,7 +32,7 @@

 #pragma GCC system_header

-#include <streambuf>
+#include <iosfwd>
 #include <debug/debug.h>

 namespace std _GLIBCXX_VISIBILITY(default)


More information about the Gcc-bugs mailing list