Make tuple_element static_assert in pair if the index is out of range. Also, add a message to variant_alternative<> in the similar case (it already asserted). Add tests for this
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305196 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -278,7 +278,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp>
|
||||
|
||||
template <size_t _Ip, class... _Types>
|
||||
struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
|
||||
static_assert(_Ip < sizeof...(_Types));
|
||||
static_assert(_Ip < sizeof...(_Types), "Index out of bounds in std::variant_alternative<>");
|
||||
using type = __type_pack_element<_Ip, _Types...>;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user