On 14/05/2015 15:47, Jonathan Wakely wrote:
Reported by Nathan and fixed by his patch. I added the tests.
Tested powerpc64le-linux, committed to trunk. This should be
backported too.
While backporting to debug and profile mode I noticed that those
constructors were not the only missing ones. So here is a patch to
complete them with debug and profile modes.
Moreover this patch:
- Remove explicit keyword on one of the unordered_map constructor,
surely the result of a copy/paste
- Use constructor delegation as proposed by the Standard
- Move code to follow Standard description order, it is easier this way
to check that nothing is missing.
* include/bits/unordered_map.h (unordered_map, unordered_multimap): Add
missing constructors.
* include/bits/unordered_set.h (unordered_set, unordered_multiset):
Likewise.
* include/debug/unordered_map (unordered_map, unordered_multimap): Add
missing constructors.
* include/debug/unordered_set (unordered_set, unordered_multiset):
Likewise.
* include/profile/unordered_map (unordered_map,
unordered_multimap): Add
missing constructors.
* include/profile/unordered_set (unordered_set, unordered_multiset):
Likewise.
* testsuite/23_containers/unordered_map/cons/66055.cc: Add constructor
invocations.
* testsuite/23_containers/unordered_multimap/cons/66055.cc: Likewise.
* testsuite/23_containers/unordered_multiset/cons/66055.cc: Likewise.
* testsuite/23_containers/unordered_set/cons/66055.cc: Likewise.
Ok to commit ?
François
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 069b859..6ace59d 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -146,17 +146,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_h(__n, __hf, __eql, __a)
{ }
- unordered_map(size_type __n, const allocator_type& __a)
- : _M_h(__n, hasher(), key_equal(), __a)
- { }
-
- explicit
- unordered_map(size_type __n,
- const hasher& __hf,
- const allocator_type& __a)
- : _M_h(__n, __hf, key_equal(), __a)
- { }
-
/**
* @brief Builds an %unordered_map from a range.
* @param __first An input iterator.
@@ -233,6 +222,41 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_h(__l, __n, __hf, __eql, __a)
{ }
+ unordered_map(size_type __n, const allocator_type& __a)
+ : unordered_map(__n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_map(size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_map(__n, __hf, key_equal(), __a)
+ { }
+
+ template
+ unordered_map(_InputIterator __first, _InputIterator __last,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_map(__first, __last, __n, hasher(), key_equal(), __a)
+ { }
+
+ template
+ unordered_map(_InputIterator __first, _InputIterator __last,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_map(__first, __last, __n, __hf, key_equal(), __a)
+ { }
+
+ unordered_map(initializer_list __l,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_map(__l, __n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_map(initializer_list __l,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_map(__l, __n, __hf, key_equal(), __a)
+ { }
+
/// Copy assignment operator.
unordered_map&
operator=(const unordered_map&) = default;
@@ -872,16 +896,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_h(__n, __hf, __eql, __a)
{ }
- unordered_multimap(size_type __n, const allocator_type& __a)
- : _M_h(__n, hasher(), key_equal(), __a)
- { }
-
- unordered_multimap(size_type __n,
- const hasher& __hf,
- const allocator_type& __a)
- : _M_h(__n, __hf, key_equal(), __a)
- { }
-
/**
* @brief Builds an %unordered_multimap from a range.
* @param __first An input iterator.
@@ -958,6 +972,41 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_h(__l, __n, __hf, __eql, __a)
{ }
+ unordered_multimap(size_type __n, const allocator_type& __a)
+ : unordered_multimap(__n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_multimap(size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_multimap(__n, __hf, key_equal(), __a)
+ { }
+
+ template
+ unordered_multimap(_InputIterator __first, _InputIterator __last,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a)
+ { }
+
+ template
+ unordered_multimap(_InputIterator __first, _InputIterator __last,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a)
+ { }
+
+ unordere