On 11/28/18 7:25 PM, Jonathan Wakely wrote:
On 28/11/18 12:12 -0500, Ed Smith-Rowland wrote:
Index: testsuite/21_strings/basic_string/erasure.cc
===================================================================
--- testsuite/21_strings/basic_string/erasure.cc (nonexistent)
+++ testsuite/21_strings/basic_string/erasure.cc (working copy)
@@ -0,0 +1,53 @@
+// { dg-do run { target c++2a } }
+
None of these new tests actually run by default, because they are
gated to only run for C++2a and the default is gnu++14. That means
they're all skipped as UNSUPPORTED.
(When I add new tests I always try to remember to check the
testsuite/libstdc++.sum file to make sure they are actually running).
The tests need an explicit -std option added via dg-options, which has
to come before the dg-do directive, otherwise the target check still
uses the default options i.e.
// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
With that added, most of them start to FAIL:
FAIL: 23_containers/deque/erasure.cc (test for excess errors)
UNRESOLVED: 23_containers/deque/erasure.cc compilation failed to
produce executable
FAIL: 23_containers/unordered_set/erasure.cc (test for excess errors)
UNRESOLVED: 23_containers/unordered_set/erasure.cc compilation failed
to produce executable
FAIL: 23_containers/vector/erasure.cc (test for excess errors)
UNRESOLVED: 23_containers/vector/erasure.cc compilation failed to
produce executable
FAIL: experimental/deque/erasure.cc (test for excess errors)
UNRESOLVED: experimental/deque/erasure.cc compilation failed to
produce executable
FAIL: experimental/forward_list/erasure.cc (test for excess errors)
UNRESOLVED: experimental/forward_list/erasure.cc compilation failed to
produce executable
FAIL: experimental/list/erasure.cc (test for excess errors)
UNRESOLVED: experimental/list/erasure.cc compilation failed to produce
executable
FAIL: experimental/vector/erasure.cc (test for excess errors)
UNRESOLVED: experimental/vector/erasure.cc compilation failed to
produce executable
The errors are all like:
In file included from
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/23_containers/vector/erasure.cc:21:
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/vector:
In function 'void std::erase_if(std::vector<_Tp, _Alloc>&, _Predicate)':
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/vector:101:
error: 'remove_if' is not a member of 'std'; did you mean 'remove_cv'?
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/vector:
In function 'void std::erase(std::vector<_Tp, _Alloc>&, const _Up&)':
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/vector:109:
error: 'remove' is not a member of 'std'; did you mean 'move'?
This is because std::remove and std::remove_if are defined in
<bits/stl_algo.h> which is not included.
Could you please fix this ASAP
Sorry about that.
Fixed with 266616.
Ed
2018-11-29 Edward Smith-Rowland <3dw...@verizon.net>
Fix erasure goofs.
* include/experimental/deque: Make inline.
* include/std/deque: Include bits/stl_algo.h.
(erase, erase_if): Make inline.
* include/std/string: Include bits/stl_algo.h.
* include/std/unordered_set: Add erase, erase_if!
* include/std/vector: Include bits/stl_algo.h.
* testsuite/21_strings/basic_string/erasure.cc:
Add { dg-options "-std=gnu++2a" }.
* testsuite/23_containers/deque/erasure.cc: Ditto.
* testsuite/23_containers/forward_list/erasure.cc: Ditto.
* testsuite/23_containers/list/erasure.cc: Ditto.
* testsuite/23_containers/map/erasure.cc: Ditto.
* testsuite/23_containers/set/erasure.cc: Ditto.
* testsuite/23_containers/unordered_map/erasure.cc: Ditto.
* testsuite/23_containers/unordered_set/erasure.cc: Ditto.
* testsuite/23_containers/vector/erasure.cc: Ditto.
Index: include/experimental/deque
===================================================================
--- include/experimental/deque (revision 266566)
+++ include/experimental/deque (working copy)
@@ -46,7 +46,7 @@
inline namespace fundamentals_v2
{
template<typename _Tp, typename _Alloc, typename _Predicate>
- void
+ inline void
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
@@ -54,7 +54,7 @@
}
template<typename _Tp, typename _Alloc, typename _Up>
- void
+ inline void
erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
Index: include/std/deque
===================================================================
--- include/std/deque (revision 266567)
+++ include/std/deque (working copy)
@@ -58,6 +58,7 @@
#pragma GCC system_header
#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h> // For remove and remove_if
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
@@ -92,7 +93,7 @@
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp, typename _Alloc, typename _Predicate>
- void
+ inline void
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
@@ -100,7 +101,7 @@
}
template<typename _Tp, typename _Alloc, typename _Up>
- void
+ inline void
erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
Index: include/std/string
===================================================================
--- include/std/string (revision 266567)
+++ include/std/string (working copy)
@@ -48,10 +48,10 @@
#include <bits/stl_function.h> // For less
#include <ext/numeric_traits.h>
#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h> // For remove and remove_if
#include <bits/range_access.h>
#include <bits/basic_string.h>
#include <bits/basic_string.tcc>
-#include <algorithm> // For remove and remove_if
#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
Index: include/std/unordered_set
===================================================================
--- include/std/unordered_set (revision 266567)
+++ include/std/unordered_set (working copy)
@@ -82,6 +82,19 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ template<typename _Key, typename _Hash, typename _CPred, typename _Alloc,
+ typename _Predicate>
+ inline void
+ erase_if(unordered_set<_Key, _Hash, _CPred, _Alloc>& __cont,
+ _Predicate __pred)
+ { std::__detail::__erase_nodes_if(__cont, __pred); }
+
+ template<typename _Key, typename _Hash, typename _CPred, typename _Alloc,
+ typename _Predicate>
+ inline void
+ erase_if(unordered_multiset<_Key, _Hash, _CPred, _Alloc>& __cont,
+ _Predicate __pred)
+ { std::__detail::__erase_nodes_if(__cont, __pred); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++20
Index: include/std/vector
===================================================================
--- include/std/vector (revision 266567)
+++ include/std/vector (working copy)
@@ -58,6 +58,7 @@
#pragma GCC system_header
#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h> // For remove and remove_if
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
Index: testsuite/21_strings/basic_string/erasure.cc
===================================================================
--- testsuite/21_strings/basic_string/erasure.cc (revision 266567)
+++ testsuite/21_strings/basic_string/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/deque/erasure.cc
===================================================================
--- testsuite/23_containers/deque/erasure.cc (revision 266567)
+++ testsuite/23_containers/deque/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/forward_list/erasure.cc
===================================================================
--- testsuite/23_containers/forward_list/erasure.cc (revision 266567)
+++ testsuite/23_containers/forward_list/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/list/erasure.cc
===================================================================
--- testsuite/23_containers/list/erasure.cc (revision 266567)
+++ testsuite/23_containers/list/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/map/erasure.cc
===================================================================
--- testsuite/23_containers/map/erasure.cc (revision 266567)
+++ testsuite/23_containers/map/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/set/erasure.cc
===================================================================
--- testsuite/23_containers/set/erasure.cc (revision 266567)
+++ testsuite/23_containers/set/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/unordered_map/erasure.cc
===================================================================
--- testsuite/23_containers/unordered_map/erasure.cc (revision 266567)
+++ testsuite/23_containers/unordered_map/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/unordered_set/erasure.cc
===================================================================
--- testsuite/23_containers/unordered_set/erasure.cc (revision 266567)
+++ testsuite/23_containers/unordered_set/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.
Index: testsuite/23_containers/vector/erasure.cc
===================================================================
--- testsuite/23_containers/vector/erasure.cc (revision 266567)
+++ testsuite/23_containers/vector/erasure.cc (working copy)
@@ -1,3 +1,4 @@
+// { dg-options "-std=gnu++2a" }
// { dg-do run { target c++2a } }
// Copyright (C) 2018 Free Software Foundation, Inc.