Avoid ambiguity between C++2a std::erase_if and LFTS version
authorJonathan Wakely <jwakely@redhat.com>
Tue, 29 Jan 2019 00:47:38 +0000 (00:47 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 29 Jan 2019 00:47:38 +0000 (00:47 +0000)
These calls should have been qualified to avoid ADL anyway, but in C++2a
it becomes essential to qualify the calls in experimental::erase because
std::erase_if is also declared and the calls become ambiguous.

* include/experimental/forward_list (experimental::erase): Qualify
call to erase_if.
* include/experimental/list (experimental::erase): Likewise.
* include/std/forward_list (std::erase): Likewise.
* include/std/list (std::erase): Likewise.

From-SVN: r268356

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/forward_list
libstdc++-v3/include/experimental/list
libstdc++-v3/include/std/forward_list
libstdc++-v3/include/std/list

index fc6f7d1a210933db83cad620d78832c42af2a859..7af725ae7bf7be0231243334df83af011d7f278e 100644 (file)
@@ -1,5 +1,11 @@
 2019-01-29  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/experimental/forward_list (experimental::erase): Qualify
+       call to erase_if.
+       * include/experimental/list (experimental::erase): Likewise.
+       * include/std/forward_list (std::erase): Likewise.
+       * include/std/list (std::erase): Likewise.
+
        * testsuite/20_util/reference_wrapper/result_type.cc: Disable for
        C++2a.
        * testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise.
index 60f0564f0658fdc695661e397c30e0933f4905cb..f6ffbf0a0af53f9b75a12e2483a1b84c2524630a 100644 (file)
@@ -54,7 +54,9 @@ inline namespace fundamentals_v2
     erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value)
     {
       using __elem_type = typename forward_list<_Tp, _Alloc>::value_type;
-      erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; });
+      std::experimental::erase_if(__cont, [&](__elem_type& __elem) {
+         return __elem == __value;
+      });
     }
 
   namespace pmr {
index 13c33f02e721ee866406ba9f52fd08ce01d892d0..2b7a331e63afb5ae3ada99ff0815f61482f164ab 100644 (file)
@@ -54,7 +54,9 @@ inline namespace fundamentals_v2
     erase(list<_Tp, _Alloc>& __cont, const _Up& __value)
     {
       using __elem_type = typename list<_Tp, _Alloc>::value_type;
-      erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; });
+      experimental::erase_if(__cont, [&](__elem_type& __elem) {
+         return __elem == __value;
+      });
     }
 
 namespace pmr {
index 3d3b6d4f5f6dd315017709848b7986cd0c330931..9d6cc40593babc6b582a82e7053102c1a7d928a0 100644 (file)
@@ -78,8 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value)
     {
       using __elem_type = typename forward_list<_Tp, _Alloc>::value_type;
-      return erase_if(__cont,
-                     [&](__elem_type& __elem) { return __elem == __value; });
+      return std::erase_if(__cont, [&](__elem_type& __elem) {
+         return __elem == __value;
+      });
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
index 7b02e8685d48e4ee89cb4f520436857d1f379085..8d6ac198c9a720853795a12848b5aec5142ec21d 100644 (file)
@@ -102,8 +102,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     erase(list<_Tp, _Alloc>& __cont, const _Up& __value)
     {
       using __elem_type = typename list<_Tp, _Alloc>::value_type;
-      return erase_if(__cont,
-                     [&](__elem_type& __elem) { return __elem == __value; });
+      return std::erase_if(__cont, [&](__elem_type& __elem) {
+         return __elem == __value;
+      });
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std