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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Should be fixed now.

We could also do something like the following, but I don't think it's worth
bothering with:

diff --git a/libstdc++-v3/include/bits/algorithmfwd.h
b/libstdc++-v3/include/bits/algorithmfwd.h
index 40e051aa9e3..72b37026836 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -847,7 +847,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std

 #ifdef _GLIBCXX_PARALLEL
-# include <parallel/algorithmfwd.h>
+# if __has_include(<omp.h>)
+#  include <parallel/algorithmfwd.h>
+# else
+#  warning "_GLIBCXX_PARALLEL is defined, but libgomp is not enabled"
+# endif
 #endif

 #endif
diff --git a/libstdc++-v3/include/bits/stl_algobase.h
b/libstdc++-v3/include/bits/stl_algobase.h
index 2b69e658fe8..463d89b7123 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -1456,7 +1456,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 // of getting the base algorithms. So, make sure that parallel bits
 // come in too if requested.
 #ifdef _GLIBCXX_PARALLEL
-# include <parallel/algobase.h>
+# if __has_include(<omp.h>)
+#  include <parallel/algobase.h>
+# else
+#  warning "_GLIBCXX_PARALLEL is defined, but libgomp is not enabled"
+# endif
 #endif

 #endif
diff --git a/libstdc++-v3/include/experimental/functional
b/libstdc++-v3/include/experimental/functional
index 90f2652c29b..bcaf9f80ca9 100644
--- a/libstdc++-v3/include/experimental/functional
+++ b/libstdc++-v3/include/experimental/functional
@@ -40,7 +40,7 @@
 #include <vector>
 #include <array>
 #include <bits/stl_algo.h>
-#ifdef _GLIBCXX_PARALLEL
+#if defined _GLIBCXX_PARALLEL && __has_include(<omp.h>)
 # include <parallel/algorithm> // For std::__parallel::search
 #endif
 #include <experimental/bits/lfts_config.h>

Reply via email to