This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 22.6.7 [variant.visit] Status: Resolved Submitter: Casey Carter Opened: 2018-01-23 Last modified: 2021-05-18
Priority: 2
View all other issues in [variant.visit].
View all issues with Resolved status.
Discussion:
std::visit accepts a parameter pack of forwarding references named vars whose types are the parameter pack Variants. Despite that:
[2018-01-24, Daniel comments]
This issue should be reviewed in common with LWG 2970.
[2018-06-18 after reflector discussion]
Priority set to 2; status to LEWG
[2020-11-18; this will be resolved by P2162.]
[2021-04-19 P2162R2 was adopted at February 2021 plenary. Status changed: Tentatively Resolved → Resolved.]
Proposed resolution:
This wording is relative to N4727.
Modify 22.6.7 [variant.visit] as indicated:
template<class Visitor, class... Variants> constexpr see below visit(Visitor&& vis, Variants&&... vars);[…]
-4- Throws: bad_variant_access if
any variant in vars is valueless_by_exception()(vars.valueless_by_exception() || ...) is true.-5- Complexity: […]
-?- Remarks: This function shall not participate in overload resolution unless remove_cvref_t<Variantsi> is a specialization of variant for all 0 <= i < n.