Added static_assert to std::get<N>(std::array) calls to catch "out of bounds" calls

llvm-svn: 170435
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 36a60721ceccdb41ccd01d603e7c92ff7c2bae1a
diff --git a/include/array b/include/array
index 029bfd0..f4a3020 100644
--- a/include/array
+++ b/include/array
@@ -310,6 +310,7 @@
 _Tp&
 get(array<_Tp, _Size>& __a) _NOEXCEPT
 {
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
     return __a[_Ip];
 }
 
@@ -318,6 +319,7 @@
 const _Tp&
 get(const array<_Tp, _Size>& __a) _NOEXCEPT
 {
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
     return __a[_Ip];
 }
 
@@ -328,6 +330,7 @@
 _Tp&&
 get(array<_Tp, _Size>&& __a) _NOEXCEPT
 {
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
     return _VSTD::move(__a[_Ip]);
 }