Title
Program-defined specializations of std::tuple and std::variant can't be properly supported
Status
wp
Section
[tuple.tuple][variant.variant.general]
Submitter
Jiang An

Created on 2023-08-29.00:00:00 last changed 5 months ago

Messages

Date: 2023-11-13.14:08:10

Proposed resolution:

This wording is relative to N4958.

  1. Modify [tuple.tuple] as indicated:

    namespace std {
      template<class... Types>
      class tuple {
        […]
      };
    
      […]
    }
    

    -?- If a program declares an explicit or partial specialization of tuple, the program is ill-formed, no diagnostic required.

  2. Modify [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.

Date: 2023-11-11.00:00:00

[ 2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP. ]

Date: 2023-11-15.00:00:00

[ 2023-11-02; Reflector poll ]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Date: 2023-08-29.00:00:00

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.

History
Date User Action Args
2023-11-13 14:08:10adminsetmessages: + msg13854
2023-11-13 14:08:10adminsetstatus: voting -> wp
2023-11-07 21:41:54adminsetstatus: ready -> voting
2023-11-03 18:08:35adminsetmessages: + msg13814
2023-11-03 18:08:35adminsetstatus: new -> ready
2023-10-03 10:24:56adminsetmessages: + msg13747
2023-08-29 00:00:00admincreate