Issue 3990: Program-defined specializations of std::tuple and std::variant can't be properly supported (original) (raw)
This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
3990. Program-defined specializations of std::tuple
and std::variant
can't be properly supported
Section: 22.4.4 [tuple.tuple], 22.6.3.1 [variant.variant.general] Status: WP Submitter: Jiang An Opened: 2023-08-29 Last modified: 2023-11-22
Priority: Not Prioritized
View all other issues in [tuple.tuple].
View all issues with WP status.
Discussion:
Currently, program-defined specializations of std::tuple
and std::variant
are not explicitly disallowed. However, they can't be properly supported by standard library implementations, because the corresponding std::get
function templates have to inspect the implementation details of these types, and users have no way to make std::get
behave correctly for a program-defined specializations.
Perhaps we should explicitly disallow specializing std::tuple
and std::variant
.
[2023-11-02; Reflector poll]
Set status to Tentatively Ready after five votes in favour during reflector poll.
[2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4958.
- Modify 22.4.4 [tuple.tuple] as indicated:
namespace std {
template<class... Types>
class tuple {
[…]
};[…]
}
-?- If a program declares an explicit or partial specialization oftuple
, the program is ill-formed, no diagnostic required. - Modify 22.6.3.1 [variant.variant.general] as indicated:
[…]
-3- A program that instantiates the definition of
variant
with no template arguments is ill-formed.-?- If a program declares an explicit or partial specialization of
variant
, the program is ill-formed, no diagnostic required.