summaryrefslogtreecommitdiffstats
path: root/libcxx/include/set
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-11-26 01:24:04 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-11-26 01:24:04 +0000
commit94f89aeec5eb6a720f734b84523451d92206c0bb (patch)
treefb38a79ecab4d5d03195d749bc89bc3420849ba7 /libcxx/include/set
parentbcd150362aff56aafdecb5545b36a50c00c63cd5 (diff)
downloadbcm5719-llvm-94f89aeec5eb6a720f734b84523451d92206c0bb.tar.gz
bcm5719-llvm-94f89aeec5eb6a720f734b84523451d92206c0bb.zip
Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this.
llvm-svn: 254119
Diffstat (limited to 'libcxx/include/set')
-rw-r--r--libcxx/include/set6
1 files changed, 6 insertions, 0 deletions
diff --git a/libcxx/include/set b/libcxx/include/set
index 9d64a521da1..ac69e085241 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -409,6 +409,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
@@ -819,6 +822,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
OpenPOWER on IntegriCloud