aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-11-21 20:47:09 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2017-11-21 20:47:09 +0000
commit866e4d3853ccc0bc61e3764911d2a0f69c281f0c (patch)
treea5b1601ca999eb5b5adc347e7dbc787e7e89b78f /libstdc++-v3
parent6a33d0ff21e941fc3a65f23a753cc318aaae82b5 (diff)
downloadgcc-866e4d3853ccc0bc61e3764911d2a0f69c281f0c.zip
gcc-866e4d3853ccc0bc61e3764911d2a0f69c281f0c.tar.gz
gcc-866e4d3853ccc0bc61e3764911d2a0f69c281f0c.tar.bz2
PR libstdc++/48101 improve errors for invalid container specializations
PR libstdc++/48101 * include/bits/allocator.h (allocator<const _Tp>) (allocator<volatile _Tp>, allocator<const volatile _Tp>): Add partial specializations. * include/bits/forward_list.h (forward_list): Add static assertions. * include/bits/hashtable.h (__cache_default): Use __is_nothrow_invocable instead of __is_noexcept_hash. (_Hashtable): Add static assertions. * include/bits/hashtable_policy.h (__is_noexcept_hash): Remove. * include/bits/stl_deque.h (deque): Add static assertions. * include/bits/stl_function.h (_Identity<const _Tp>): Add partial specialization. * include/bits/stl_list.h (list): Add static assertions. * include/bits/stl_map.h (map): Likewise. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_tree.h (_Rb_tree): Likewise. * include/bits/stl_vector.h (vector): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): Use typename instead of class in template-parameter-list and remove spaces. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/deque/48101-2_neg.cc: New test. * testsuite/23_containers/deque/48101_neg.cc: New test. * testsuite/23_containers/forward_list/48101-2_neg.cc: New test. * testsuite/23_containers/forward_list/48101_neg.cc: New test. * testsuite/23_containers/list/48101-2_neg.cc: New test. * testsuite/23_containers/list/48101_neg.cc: New test. * testsuite/23_containers/map/48101-2_neg.cc: New test. * testsuite/23_containers/map/48101_neg.cc: New test. * testsuite/23_containers/map/operations/31440.cc: Fix comparison object to have const-qualified call operator. * testsuite/23_containers/multimap/48101-2_neg.cc: New test. * testsuite/23_containers/multimap/48101_neg.cc: New test. * testsuite/23_containers/multiset/48101-2_neg.cc: New test. * testsuite/23_containers/multiset/48101_neg.cc: New test. * testsuite/23_containers/set/48101-2_neg.cc: New test. * testsuite/23_containers/set/48101_neg.cc: New test. * testsuite/23_containers/unordered_map/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_map/48101_neg.cc: New test. * testsuite/23_containers/unordered_multimap/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_multimap/48101_neg.cc: New test. * testsuite/23_containers/unordered_multiset/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_multiset/48101_neg.cc: New test. * testsuite/23_containers/unordered_set/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_set/48101_neg.cc: New test. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust dg-error line number. * testsuite/23_containers/vector/48101-2_neg.cc: New test. * testsuite/23_containers/vector/48101_neg.cc: New test. From-SVN: r255035
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog55
-rw-r--r--libstdc++-v3/include/bits/allocator.h28
-rw-r--r--libstdc++-v3/include/bits/forward_list.h9
-rw-r--r--libstdc++-v3/include/bits/hashtable.h14
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h6
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h9
-rw-r--r--libstdc++-v3/include/bits/stl_function.h5
-rw-r--r--libstdc++-v3/include/bits/stl_list.h9
-rw-r--r--libstdc++-v3/include/bits/stl_map.h5
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h5
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h9
-rw-r--r--libstdc++-v3/include/bits/stl_set.h9
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h5
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h9
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h16
-rw-r--r--libstdc++-v3/include/bits/unordered_set.h16
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/48101_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/48101_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/48101_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/48101_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/operations/31440.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/48101_neg.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/48101-2_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-2_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-2_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/48101-2_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/48101-2_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/48101_neg.cc29
42 files changed, 903 insertions, 28 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index cecc73b..c2f870a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,58 @@
+2017-11-21 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/48101
+ * include/bits/allocator.h (allocator<const _Tp>)
+ (allocator<volatile _Tp>, allocator<const volatile _Tp>): Add partial
+ specializations.
+ * include/bits/forward_list.h (forward_list): Add static assertions.
+ * include/bits/hashtable.h (__cache_default): Use
+ __is_nothrow_invocable instead of __is_noexcept_hash.
+ (_Hashtable): Add static assertions.
+ * include/bits/hashtable_policy.h (__is_noexcept_hash): Remove.
+ * include/bits/stl_deque.h (deque): Add static assertions.
+ * include/bits/stl_function.h (_Identity<const _Tp>): Add partial
+ specialization.
+ * include/bits/stl_list.h (list): Add static assertions.
+ * include/bits/stl_map.h (map): Likewise.
+ * include/bits/stl_multimap.h (multimap): Likewise.
+ * include/bits/stl_multiset.h (multiset): Likewise.
+ * include/bits/stl_set.h (set): Likewise.
+ * include/bits/stl_tree.h (_Rb_tree): Likewise.
+ * include/bits/stl_vector.h (vector): Likewise.
+ * include/bits/unordered_map.h (unordered_map, unordered_multimap):
+ Use typename instead of class in template-parameter-list and remove
+ spaces.
+ * include/bits/unordered_set.h (unordered_set, unordered_multiset):
+ Likewise.
+ * testsuite/23_containers/deque/48101-2_neg.cc: New test.
+ * testsuite/23_containers/deque/48101_neg.cc: New test.
+ * testsuite/23_containers/forward_list/48101-2_neg.cc: New test.
+ * testsuite/23_containers/forward_list/48101_neg.cc: New test.
+ * testsuite/23_containers/list/48101-2_neg.cc: New test.
+ * testsuite/23_containers/list/48101_neg.cc: New test.
+ * testsuite/23_containers/map/48101-2_neg.cc: New test.
+ * testsuite/23_containers/map/48101_neg.cc: New test.
+ * testsuite/23_containers/map/operations/31440.cc: Fix comparison
+ object to have const-qualified call operator.
+ * testsuite/23_containers/multimap/48101-2_neg.cc: New test.
+ * testsuite/23_containers/multimap/48101_neg.cc: New test.
+ * testsuite/23_containers/multiset/48101-2_neg.cc: New test.
+ * testsuite/23_containers/multiset/48101_neg.cc: New test.
+ * testsuite/23_containers/set/48101-2_neg.cc: New test.
+ * testsuite/23_containers/set/48101_neg.cc: New test.
+ * testsuite/23_containers/unordered_map/48101-2_neg.cc: New test.
+ * testsuite/23_containers/unordered_map/48101_neg.cc: New test.
+ * testsuite/23_containers/unordered_multimap/48101-2_neg.cc: New test.
+ * testsuite/23_containers/unordered_multimap/48101_neg.cc: New test.
+ * testsuite/23_containers/unordered_multiset/48101-2_neg.cc: New test.
+ * testsuite/23_containers/unordered_multiset/48101_neg.cc: New test.
+ * testsuite/23_containers/unordered_set/48101-2_neg.cc: New test.
+ * testsuite/23_containers/unordered_set/48101_neg.cc: New test.
+ * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
+ dg-error line number.
+ * testsuite/23_containers/vector/48101-2_neg.cc: New test.
+ * testsuite/23_containers/vector/48101_neg.cc: New test.
+
2017-11-21 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
* doc/xml/manual/using.xml (manual.intro.using.macros): Move
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index 2081386..b5a2bad 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -105,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @tparam _Tp Type of allocated object.
*/
template<typename _Tp>
- class allocator: public __allocator_base<_Tp>
+ class allocator : public __allocator_base<_Tp>
{
public:
typedef size_t size_type;
@@ -165,6 +165,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_USE_NOEXCEPT
{ return false; }
+ // Invalid allocator<cv T> partial specializations.
+ // allocator_traits::rebind_alloc can be used to form a valid allocator type.
+ template<typename _Tp>
+ class allocator<const _Tp>
+ {
+ public:
+ typedef _Tp value_type;
+ template<typename _Up> allocator(const allocator<_Up>&) { }
+ };
+
+ template<typename _Tp>
+ class allocator<volatile _Tp>
+ {
+ public:
+ typedef _Tp value_type;
+ template<typename _Up> allocator(const allocator<_Up>&) { }
+ };
+
+ template<typename _Tp>
+ class allocator<const volatile _Tp>
+ {
+ public:
+ typedef _Tp value_type;
+ template<typename _Up> allocator(const allocator<_Up>&) { }
+ };
+
/// @} group allocator
// Inhibit implicit instantiations for required instantiations,
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 855a728..96494cc 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -406,9 +406,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* specialized algorithms %unique to linked lists, such as
* splicing, sorting, and in-place reversal.
*/
- template<typename _Tp, typename _Alloc = allocator<_Tp> >
+ template<typename _Tp, typename _Alloc = allocator<_Tp>>
class forward_list : private _Fwd_list_base<_Tp, _Alloc>
{
+ static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
+ "std::forward_list must have a non-const, non-volatile value_type");
+#ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
+ "std::forward_list must have the same value_type as its allocator");
+#endif
+
private:
typedef _Fwd_list_base<_Tp, _Alloc> _Base;
typedef _Fwd_list_node<_Tp> _Node;
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index e0806dc..a9473c1 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -46,7 +46,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= __not_<__and_<// Do not cache for fast hasher.
__is_fast_hash<_Hash>,
// Mandatory to have erase not throwing.
- __detail::__is_noexcept_hash<_Tp, _Hash>>>;
+ __is_nothrow_invocable<const _Hash&, const _Tp&>>>;
/**
* Primary class template _Hashtable.
@@ -186,6 +186,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__detail::_Hash_node<_Value,
_Traits::__hash_cached::value>>>
{
+ static_assert(is_same<typename remove_cv<_Value>::type, _Value>::value,
+ "unordered container must have a non-const, non-volatile value_type");
+#ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Value>{},
+ "unordered container must have the same value_type as its allocator");
+#endif
+ static_assert(__is_invocable<const _H1&, const _Key&>{},
+ "hash function must be invocable with an argument of key type");
+ static_assert(__is_invocable<const _Equal&, const _Key&, const _Key&>{},
+ "key equality predicate must be invocable with two arguments of "
+ "key type");
+
using __traits_type = _Traits;
using __hash_cached = typename __traits_type::__hash_cached;
using __node_type = __detail::_Hash_node<_Value, __hash_cached::value>;
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index e19f92a..4dd0e17 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -79,12 +79,6 @@ namespace __detail
return __distance_fw(__first, __last, _Tag());
}
- // Helper type used to detect whether the hash functor is noexcept.
- template <typename _Key, typename _Hash>
- struct __is_noexcept_hash : std::__bool_constant<
- noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
- { };
-
struct _Identity
{
template<typename _Tp>
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index 48b2bc7..93c82ca 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -840,6 +840,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L
+ static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
+ "std::deque must have a non-const, non-volatile value_type");
+# ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
+ "std::deque must have the same value_type as its allocator");
+# endif
+#endif
+
typedef _Deque_base<_Tp, _Alloc> _Base;
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
typedef typename _Base::_Alloc_traits _Alloc_traits;
diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index 4fbcdb9..5cd8e3a 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -867,7 +867,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
struct _Identity
- : public unary_function<_Tp,_Tp>
+ : public unary_function<_Tp, _Tp>
{
_Tp&
operator()(_Tp& __x) const
@@ -878,6 +878,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __x; }
};
+ // Partial specialization, avoids confusing errors in e.g. std::set<const T>.
+ template<typename _Tp> struct _Identity<const _Tp> : _Identity<_Tp> { };
+
template<typename _Pair>
struct _Select1st
: public unary_function<_Pair, typename _Pair::first_type>
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index be5bb5e..8ed97f7 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -571,6 +571,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L
+ static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
+ "std::list must have a non-const, non-volatile value_type");
+# ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
+ "std::list must have the same value_type as its allocator");
+# endif
+#endif
+
typedef _List_base<_Tp, _Alloc> _Base;
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
typedef typename _Base::_Tp_alloc_traits _Tp_alloc_traits;
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 8a9e6c9..bec6c47 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -118,6 +118,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L && defined(__STRICT_ANSI__)
+ static_assert(is_same<typename _Alloc::value_type, value_type>::value,
+ "std::map must have the same value_type as its allocator");
+#endif
+
public:
class value_compare
: public std::binary_function<value_type, value_type, bool>
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 1a16bf9..24ac4a3 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -117,6 +117,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L && defined(__STRICT_ANSI__)
+ static_assert(is_same<typename _Alloc::value_type, value_type>::value,
+ "std::multimap must have the same value_type as its allocator");
+#endif
+
public:
class value_compare
: public std::binary_function<value_type, value_type, bool>
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index d34b675..ff7d3dc 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -106,6 +106,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L
+ static_assert(is_same<typename remove_cv<_Key>::type, _Key>::value,
+ "std::multiset must have a non-const, non-volatile value_type");
+# ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Key>::value,
+ "std::multiset must have the same value_type as its allocator");
+# endif
+#endif
+
public:
// typedefs:
typedef _Key key_type;
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index 3a7992c..e07d781 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -104,6 +104,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L
+ static_assert(is_same<typename remove_cv<_Key>::type, _Key>::value,
+ "std::set must have a non-const, non-volatile value_type");
+# ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Key>::value,
+ "std::set must have the same value_type as its allocator");
+# endif
+#endif
+
public:
// typedefs:
//@{
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index c2417f1..ff36618 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -448,6 +448,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __gnu_cxx::__alloc_traits<_Node_allocator> _Alloc_traits;
+#if __cplusplus >= 201103L
+ static_assert(__is_invocable<const _Compare&, const _Key&, const _Key&>{},
+ "comparison object must be invocable with two arguments of key type");
+#endif
+
protected:
typedef _Rb_tree_node_base* _Base_ptr;
typedef const _Rb_tree_node_base* _Const_Base_ptr;
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index c763421..aeeba82 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -347,6 +347,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
#endif
+#if __cplusplus >= 201103L
+ static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
+ "std::vector must have a non-const, non-volatile value_type");
+# ifdef __STRICT_ANSI__
+ static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
+ "std::vector must have the same value_type as its allocator");
+# endif
+#endif
+
typedef _Vector_base<_Tp, _Alloc> _Base;
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits;
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 385e4bd..cb5bcb8 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -95,10 +95,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Base is _Hashtable, dispatched at compile time via template
* alias __umap_hashtable.
*/
- template<class _Key, class _Tp,
- class _Hash = hash<_Key>,
- class _Pred = std::equal_to<_Key>,
- class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ template<typename _Key, typename _Tp,
+ typename _Hash = hash<_Key>,
+ typename _Pred = equal_to<_Key>,
+ typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
class unordered_map
{
typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable;
@@ -1229,10 +1229,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Base is _Hashtable, dispatched at compile time via template
* alias __ummap_hashtable.
*/
- template<class _Key, class _Tp,
- class _Hash = hash<_Key>,
- class _Pred = std::equal_to<_Key>,
- class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ template<typename _Key, typename _Tp,
+ typename _Hash = hash<_Key>,
+ typename _Pred = equal_to<_Key>,
+ typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
class unordered_multimap
{
typedef __ummap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable;
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
index 416dbbc..550548c 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -90,10 +90,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Base is _Hashtable, dispatched at compile time via template
* alias __uset_hashtable.
*/
- template<class _Value,
- class _Hash = hash<_Value>,
- class _Pred = std::equal_to<_Value>,
- class _Alloc = std::allocator<_Value> >
+ template<typename _Value,
+ typename _Hash = hash<_Value>,
+ typename _Pred = equal_to<_Value>,
+ typename _Alloc = allocator<_Value>>
class unordered_set
{
typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
@@ -888,10 +888,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Base is _Hashtable, dispatched at compile time via template
* alias __umset_hashtable.
*/
- template<class _Value,
- class _Hash = hash<_Value>,
- class _Pred = std::equal_to<_Value>,
- class _Alloc = std::allocator<_Value> >
+ template<typename _Value,
+ typename _Hash = hash<_Value>,
+ typename _Pred = equal_to<_Value>,
+ typename _Alloc = allocator<_Value>>
class unordered_multiset
{
typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
diff --git a/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc
new file mode 100644
index 0000000..7bb6373
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <deque>
+
+void
+test01()
+{
+ std::deque<int, std::allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/deque/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/48101_neg.cc
new file mode 100644
index 0000000..57327e0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/48101_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <deque>
+
+void
+test01()
+{
+ std::deque<const int> c;
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-prune-output "std::allocator<.* has no member named " }
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc
new file mode 100644
index 0000000..a830d7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <forward_list>
+
+void
+test01()
+{
+ std::forward_list<int, std::allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/48101_neg.cc
new file mode 100644
index 0000000..268c06d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/48101_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <forward_list>
+
+void
+test01()
+{
+ std::forward_list<const int> c;
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-prune-output "std::allocator<.* has no member named " }
diff --git a/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc
new file mode 100644
index 0000000..bce7e34
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <list>
+
+void
+test01()
+{
+ std::list<int, std::allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/list/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/list/48101_neg.cc
new file mode 100644
index 0000000..9652e07
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/48101_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <list>
+
+void
+test01()
+{
+ std::list<const int> c;
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-prune-output "std::allocator<.* has no member named " }
diff --git a/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc
new file mode 100644
index 0000000..dcb4335
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <map>
+
+void
+test01()
+{
+ std::map<int, int, std::less<int>, std::allocator<int>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
new file mode 100644
index 0000000..75821fa
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <map>
+
+void
+test01()
+{
+ std::map<int, int, std::less<int*>> c; // { dg-error "here" }
+ std::map<int, int, std::allocator<int>> c2; // { dg-error "here" }
+}
+
+// { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/map/operations/31440.cc b/libstdc++-v3/testsuite/23_containers/map/operations/31440.cc
index 6401bfe..531c74d 100644
--- a/libstdc++-v3/testsuite/23_containers/map/operations/31440.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/operations/31440.cc
@@ -38,7 +38,7 @@ private:
struct MemoTable::dagNodeLt
{
- bool operator()(const DagNode*, const DagNode*);
+ bool operator()(const DagNode*, const DagNode*) const;
};
class MemoTable::MemoMap
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/48101-2_neg.cc
new file mode 100644
index 0000000..2b8db2c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <map>
+
+void
+test01()
+{
+ std::multimap<int, int, std::less<int>, std::allocator<int>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
new file mode 100644
index 0000000..a303c75
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <map>
+
+void
+test01()
+{
+ std::multimap<int, int, std::less<int*>> c; // { dg-error "here" }
+ std::multimap<int, int, std::allocator<int>> c2; // { dg-error "here" }
+}
+
+// { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/48101-2_neg.cc
new file mode 100644
index 0000000..c9bb1f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <set>
+
+void
+test01()
+{
+ std::multiset<int, std::less<int>, std::allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc
new file mode 100644
index 0000000..3697d32
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/48101_neg.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <set>
+
+void
+test01()
+{
+ std::multiset<const int> c; // { dg-error "here" }
+ std::multiset<int, std::less<long*>> c2; // { dg-error "here" }
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
+// { dg-prune-output "std::allocator<.* has no member named " }
diff --git a/libstdc++-v3/testsuite/23_containers/set/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/set/48101-2_neg.cc
new file mode 100644
index 0000000..925d4ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <set>
+
+void
+test01()
+{
+ std::set<int, std::less<int>, std::allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc
new file mode 100644
index 0000000..258fab8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/48101_neg.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <set>
+
+void
+test01()
+{
+ std::set<const int> c; // { dg-error "here" }
+ std::set<int, std::less<long*>> c2; // { dg-error "here" }
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
+// { dg-prune-output "std::allocator<.* has no member named " }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/48101-2_neg.cc
new file mode 100644
index 0000000..847ac80
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/48101-2_neg.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <unordered_map>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_map<int, int, hash<int>, equal_to<int>, allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc
new file mode 100644
index 0000000..6180c2d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/48101_neg.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <unordered_map>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_map<int, int, equal_to<int>, hash<int>> c2; // { dg-error "here" }
+}
+
+// { dg-error "hash function must be invocable" "" { target *-*-* } 0 }
+// { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 }
+// { dg-prune-output "use of deleted function" }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-2_neg.cc
new file mode 100644
index 0000000..6b2660a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-2_neg.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <unordered_map>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_multimap<int, int, hash<int>, equal_to<int>, allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc
new file mode 100644
index 0000000..538d1dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101_neg.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <unordered_map>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_multimap<int, int, equal_to<int>, hash<int>> c2; // { dg-error "here" }
+}
+
+// { dg-error "hash function must be invocable" "" { target *-*-* } 0 }
+// { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 }
+// { dg-prune-output "use of deleted function" }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-2_neg.cc
new file mode 100644
index 0000000..6dccaa7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-2_neg.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <unordered_set>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_multiset<int, hash<int>, equal_to<int>, allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc
new file mode 100644
index 0000000..3ec61dd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <unordered_set>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_multiset<const int, hash<int>> c; // { dg-error "here" }
+ unordered_multiset<int, equal_to<int>, hash<int>> c2; // { dg-error "here" }
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-error "hash function must be invocable" "" { target *-*-* } 0 }
+// { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 }
+// { dg-prune-output "use of deleted function" }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/48101-2_neg.cc
new file mode 100644
index 0000000..1221b8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/48101-2_neg.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <unordered_set>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_set<int, hash<int>, equal_to<int>, allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc
new file mode 100644
index 0000000..d74370b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/48101_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <unordered_set>
+
+void
+test01()
+{
+ using namespace std;
+ unordered_set<const int, hash<int>> c; // { dg-error "here" }
+ unordered_set<int, equal_to<int>, hash<int>> c2; // { dg-error "here" }
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-error "hash function must be invocable" "" { target *-*-* } 0 }
+// { dg-error "key equality predicate must be invocable" "" { target *-*-* } 0 }
+// { dg-prune-output "use of deleted function" }
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc
index ac4477d..60e5b2b 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "with noexcept" "" { target *-*-* } 268 }
+// { dg-error "qualify your functors .* with noexcept" "" { target *-*-* } 0 }
#include <unordered_set>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/48101-2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/48101-2_neg.cc
new file mode 100644
index 0000000..0a54a48
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/48101-2_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+#include <vector>
+
+void
+test01()
+{
+ std::vector<int, std::allocator<long>> c;
+}
+
+// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/vector/48101_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/48101_neg.cc
new file mode 100644
index 0000000..ed70156
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/48101_neg.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <vector>
+
+void
+test01()
+{
+ std::vector<const int> c;
+}
+
+// { dg-error "non-const, non-volatile value_type" "" { target *-*-* } 0 }
+// { dg-prune-output "std::allocator<.* has no member named " }