libstdc++: Ensure std::forward_as_tuple is defined
authorJonathan Wakely <jwakely@redhat.com>
Thu, 22 Oct 2020 23:58:35 +0000 (00:58 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 23 Oct 2020 00:12:00 +0000 (01:12 +0100)
The recent changes to reduce includes in <memory_resource> went a bit
too far, and it's possible for std::forward_as_tuple to not be defined
when used.

While doing this, I noticed the problematic calls to forward_as_tuple
were not qualified, so performed unwanted ADL.

libstdc++-v3/ChangeLog:

* include/experimental/memory_resource: Include <tuple>.
(polymorphic_allocator::construct): Qualify forward_as_tuple.
* include/std/memory_resource: Likewise.

libstdc++-v3/include/experimental/memory_resource
libstdc++-v3/include/std/memory_resource

index 1c4de70c5331a1464960be99572cd6bbc51fbdf7..ca1bad9ecd0149964f9e6cd0e69687d82bef1e47 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <memory>                      // align, uses_allocator, __uses_alloc
 #include <experimental/utility>                // pair, experimental::erased_type
+#include <tuple>                       // tuple, forward_as_tuple
 #include <atomic>                      // atomic
 #include <new>                         // placement new
 #include <cstddef>                     // max_align_t
@@ -196,8 +197,8 @@ namespace pmr {
        construct(pair<_Tp1,_Tp2>* __p, _Up&& __x, _Vp&& __y)
        {
          this->construct(__p, piecewise_construct,
-                         forward_as_tuple(std::forward<_Up>(__x)),
-                         forward_as_tuple(std::forward<_Vp>(__y)));
+             std::forward_as_tuple(std::forward<_Up>(__x)),
+             std::forward_as_tuple(std::forward<_Vp>(__y)));
        }
 
       template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
@@ -205,8 +206,8 @@ namespace pmr {
        construct(pair<_Tp1,_Tp2>* __p, const std::pair<_Up, _Vp>& __pr)
        {
          this->construct(__p, piecewise_construct,
-                         forward_as_tuple(__pr.first),
-                         forward_as_tuple(__pr.second));
+             std::forward_as_tuple(__pr.first),
+             std::forward_as_tuple(__pr.second));
        }
 
       template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
@@ -214,8 +215,8 @@ namespace pmr {
        construct(pair<_Tp1,_Tp2>* __p, pair<_Up, _Vp>&& __pr)
        {
          this->construct(__p, piecewise_construct,
-                         forward_as_tuple(std::forward<_Up>(__pr.first)),
-                         forward_as_tuple(std::forward<_Vp>(__pr.second)));
+             std::forward_as_tuple(std::forward<_Up>(__pr.first)),
+             std::forward_as_tuple(std::forward<_Vp>(__pr.second)));
        }
 
       template <typename _Up>
index 350799ee3821386102cf3b9822c3d2bf5b01c162..40e23a2f9ce2f1ac7212e90c08573e773b7cd3ee 100644 (file)
@@ -45,6 +45,7 @@
 
 #if ! __cpp_lib_make_obj_using_allocator
 # include <utility>                    // pair, index_sequence
+# include <tuple>                      // tuple, forward_as_tuple
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -286,8 +287,8 @@ namespace pmr
        construct(pair<_Tp1, _Tp2>* __p, _Up&& __x, _Vp&& __y)
        {
          this->construct(__p, piecewise_construct,
-                         forward_as_tuple(std::forward<_Up>(__x)),
-                         forward_as_tuple(std::forward<_Vp>(__y)));
+             std::forward_as_tuple(std::forward<_Up>(__x)),
+             std::forward_as_tuple(std::forward<_Vp>(__y)));
        }
 
       template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
@@ -296,8 +297,8 @@ namespace pmr
        construct(pair<_Tp1, _Tp2>* __p, const std::pair<_Up, _Vp>& __pr)
        {
          this->construct(__p, piecewise_construct,
-                         forward_as_tuple(__pr.first),
-                         forward_as_tuple(__pr.second));
+             std::forward_as_tuple(__pr.first),
+             std::forward_as_tuple(__pr.second));
        }
 
       template<typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
@@ -306,8 +307,8 @@ namespace pmr
        construct(pair<_Tp1, _Tp2>* __p, pair<_Up, _Vp>&& __pr)
        {
          this->construct(__p, piecewise_construct,
-                         forward_as_tuple(std::forward<_Up>(__pr.first)),
-                         forward_as_tuple(std::forward<_Vp>(__pr.second)));
+             std::forward_as_tuple(std::forward<_Up>(__pr.first)),
+             std::forward_as_tuple(std::forward<_Vp>(__pr.second)));
        }
 #else // make_obj_using_allocator
       template<typename _Tp1, typename... _Args>