summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/associative/map
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2014-07-08 15:19:40 +0000
committerMarshall Clow <mclow.lists@gmail.com>2014-07-08 15:19:40 +0000
commit56cca89fc3aefa73e0da3e5bd10b9c85209a726a (patch)
tree4dfc67300083e87762dda3db2248023219033f29 /libcxx/test/containers/associative/map
parentcccdadca45d76ebc5f1a6a7975d3c343295d8113 (diff)
downloadbcm5719-llvm-56cca89fc3aefa73e0da3e5bd10b9c85209a726a.tar.gz
bcm5719-llvm-56cca89fc3aefa73e0da3e5bd10b9c85209a726a.zip
Fix some failing tests for the standard containers. The tests were failing in 32-bit mode because they assumed that std::size_type and make_unsigned<ptrdiff_t>::type were always the same type. No change to libc++, just the tests.
llvm-svn: 212538
Diffstat (limited to 'libcxx/test/containers/associative/map')
-rw-r--r--libcxx/test/containers/associative/map/types.pass.cpp47
1 files changed, 25 insertions, 22 deletions
diff --git a/libcxx/test/containers/associative/map/types.pass.cpp b/libcxx/test/containers/associative/map/types.pass.cpp
index 487b69f8c37..d117deff693 100644
--- a/libcxx/test/containers/associative/map/types.pass.cpp
+++ b/libcxx/test/containers/associative/map/types.pass.cpp
@@ -37,31 +37,34 @@
int main()
{
{
- static_assert((std::is_same<std::map<int, double>::key_type, int>::value), "");
- static_assert((std::is_same<std::map<int, double>::mapped_type, double>::value), "");
- static_assert((std::is_same<std::map<int, double>::value_type, std::pair<const int, double> >::value), "");
- static_assert((std::is_same<std::map<int, double>::key_compare, std::less<int> >::value), "");
- static_assert((std::is_same<std::map<int, double>::allocator_type, std::allocator<std::pair<const int, double> > >::value), "");
- static_assert((std::is_same<std::map<int, double>::reference, std::pair<const int, double>&>::value), "");
- static_assert((std::is_same<std::map<int, double>::const_reference, const std::pair<const int, double>&>::value), "");
- static_assert((std::is_same<std::map<int, double>::pointer, std::pair<const int, double>*>::value), "");
- static_assert((std::is_same<std::map<int, double>::const_pointer, const std::pair<const int, double>*>::value), "");
- static_assert((std::is_same<std::map<int, double>::size_type, std::size_t>::value), "");
- static_assert((std::is_same<std::map<int, double>::difference_type, std::ptrdiff_t>::value), "");
+ typedef std::map<int, double> C;
+ static_assert((std::is_same<C::key_type, int>::value), "");
+ static_assert((std::is_same<C::mapped_type, double>::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
+ static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<std::pair<const int, double> > >::value), "");
+ static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<C::pointer, std::pair<const int, double>*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const std::pair<const int, double>*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#if __cplusplus >= 201103L
{
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_type, int>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::mapped_type, double>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::value_type, std::pair<const int, double> >::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_compare, std::less<int> >::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::reference, std::pair<const int, double>&>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_reference, const std::pair<const int, double>&>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::pointer, min_pointer<std::pair<const int, double>>>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::size_type, std::size_t>::value), "");
- static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::difference_type, std::ptrdiff_t>::value), "");
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ static_assert((std::is_same<C::key_type, int>::value), "");
+ static_assert((std::is_same<C::mapped_type, double>::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
+ static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+ static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
+// min_allocator doesn't have a size_type, so one gets synthesized
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
}
OpenPOWER on IntegriCloud