This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix Debug insert_return_type
- From: François Dumont <frs dot dumont at gmail dot com>
- To: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 15 Dec 2017 22:19:18 +0100
- Subject: Fix Debug insert_return_type
- Authentication-results: sourceware.org; auth=none
Here is a patch to fix those failures of the latest report:
UNRESOLVED: 23_containers/map/modifiers/extract.cc compilation failed to produce executable
FAIL: 23_containers/set/modifiers/extract.cc (test for excess errors)
UNRESOLVED: 23_containers/set/modifiers/extract.cc compilation failed to produce executable
FAIL: 23_containers/unordered_map/modifiers/extract.cc (test for excess errors)
UNRESOLVED: 23_containers/unordered_map/modifiers/extract.cc compilation failed to produce executable
FAIL: 23_containers/unordered_set/modifiers/extract.cc (test for excess errors)
UNRESOLVED: 23_containers/unordered_set/modifiers/extract.cc compilation failed to produce executable
Tested under Linux x86_64 Debug mode.
Ok to commit ?
Note that I don't understand this in _Rb_tree:
using insert_return_type = _Node_insert_return<
conditional_t<is_same_v<_Key, _Val>, const_iterator, iterator>,
node_type>;
Why the conditional_t part ? In Debug mode it is always using iterator and I don't understand what represent this is_same_v<_Key, _Val> condition.
François
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index 99d0623..4844a62 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -401,13 +401,7 @@ namespace __debug
#if __cplusplus > 201402L
using node_type = typename _Base::node_type;
-
- struct insert_return_type
- {
- bool inserted;
- iterator position;
- node_type node;
- };
+ using insert_return_type = _Node_insert_return<iterator, node_type>;
node_type
extract(const_iterator __position)
@@ -431,7 +425,7 @@ namespace __debug
{
auto __ret = _Base::insert(std::move(__nh));
iterator __pos = iterator(__ret.position, this);
- return { __ret.inserted, __pos, std::move(__ret.node) };
+ return { __pos, __ret.inserted, std::move(__ret.node) };
}
iterator
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index 5353cfe..4466bfc 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -298,13 +298,7 @@ namespace __debug
#if __cplusplus > 201402L
using node_type = typename _Base::node_type;
-
- struct insert_return_type
- {
- bool inserted;
- iterator position;
- node_type node;
- };
+ using insert_return_type = _Node_insert_return<iterator, node_type>;
node_type
extract(const_iterator __position)
@@ -328,7 +322,7 @@ namespace __debug
{
auto __ret = _Base::insert(std::move(__nh));
iterator __pos = iterator(__ret.position, this);
- return { __ret.inserted, __pos, std::move(__ret.node) };
+ return { __pos, __ret.inserted, std::move(__ret.node) };
}
iterator
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index c68ccaa..0ed9922 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -462,13 +462,7 @@ namespace __debug
#if __cplusplus > 201402L
using node_type = typename _Base::node_type;
-
- struct insert_return_type
- {
- bool inserted;
- iterator position;
- node_type node;
- };
+ using insert_return_type = _Node_insert_return<iterator, node_type>;
node_type
extract(const_iterator __position)
@@ -499,7 +493,7 @@ namespace __debug
{
auto __ret = _Base::insert(std::move(__nh));
iterator __pos = iterator(__ret.position, this);
- return { __ret.inserted, __pos, std::move(__ret.node) };
+ return { __pos, __ret.inserted, std::move(__ret.node) };
}
iterator
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index 1fe493f..1f8e95f 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -372,13 +372,7 @@ namespace __debug
#if __cplusplus > 201402L
using node_type = typename _Base::node_type;
-
- struct insert_return_type
- {
- bool inserted;
- iterator position;
- node_type node;
- };
+ using insert_return_type = _Node_insert_return<iterator, node_type>;
node_type
extract(const_iterator __position)
@@ -409,7 +403,7 @@ namespace __debug
{
auto __ret = _Base::insert(std::move(__nh));
iterator __pos = iterator(__ret.position, this);
- return { __ret.inserted, __pos, std::move(__ret.node) };
+ return { __pos, __ret.inserted, std::move(__ret.node) };
}
iterator