Created on 2017-06-10.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4659.
Modify [utility.syn], header <utility> synopsis, as indicated:
[…] // [pair.astuple], tuple-like access to pair template <class T> class tuple_size; template <size_t I, class T> class tuple_element; template <class T1, class T2> struct tuple_size<pair<T1, T2>>; template <size_t I, class T1, class T2> struct tuple_element<I, pair<T1, T2>>;template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>; template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;[…]
Modify [pair.astuple] as indicated:
tuple_element<0, pair<T1, T2>>::type
-1- Value: The type T1.tuple_element<1, pair<T1, T2>>::type
-2- Value: The type T2.tuple_element<I, pair<T1, T2>>::type-?- Requires: I < 2. The program is ill-formed if I is out of bounds.
-?- Value: The type T1 if I == 0, otherwise the type T2.
Modify [variant.helper] as indicated:
variant_alternative<I, variant<Types...>>::type-4- Requires: I < sizeof...(Types). The program is ill-formed if I is out of bounds.
-5- Value: The type TI.
[ 2017-06-12, Moved to Tentatively Ready after 5 positive votes on c++std-lib ]
Instantiating tuple_element with an out-of-bounds index requires a diagnostic for tuple and array, but not for pair. The specification requires an out-of-bounds index for pair to go to the base template instead, which is undefined.
Similarly, instantiating variant_alternative with an out-of-bounds index violates a requirement, but it is not required to be diagnosed.History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2017-07-30 20:18:47 | admin | set | status: voting -> wp |
2017-06-26 13:46:20 | admin | set | status: ready -> voting |
2017-06-12 17:47:12 | admin | set | messages: + msg9248 |
2017-06-12 17:47:12 | admin | set | status: new -> ready |
2017-06-11 13:34:06 | admin | set | messages: + msg9246 |
2017-06-10 00:00:00 | admin | create |