summaryrefslogtreecommitdiffstats
path: root/libcxx/include/array
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-06-12 14:41:37 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-06-12 14:41:37 +0000
commit6db379a2c8bbc40f39a63c6c34216fe23c80127a (patch)
tree7653dfeedfe35508f246f7714578150fbe12ce09 /libcxx/include/array
parent2e33bbaff0904a8568eac4c9329a39834edf2c68 (diff)
downloadbcm5719-llvm-6db379a2c8bbc40f39a63c6c34216fe23c80127a.tar.gz
bcm5719-llvm-6db379a2c8bbc40f39a63c6c34216fe23c80127a.zip
[array.tuple]/1 says that instantiating tuple_element<N, array<T, M>> is ill-formed if N >= M. We didn't do that. Add a static_assert to cause a failure, and a test that checks that we failed
llvm-svn: 305191
Diffstat (limited to 'libcxx/include/array')
-rw-r--r--libcxx/include/array1
1 files changed, 1 insertions, 0 deletions
diff --git a/libcxx/include/array b/libcxx/include/array
index 79f7e0d62c5..12780992e5c 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -296,6 +296,7 @@ class _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
{
+ static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
public:
typedef _Tp type;
};
OpenPOWER on IntegriCloud