This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3461. convertible_to's description mishandles cv-qualified void

Section: 18.4.4 [concept.convertible] Status: C++23 Submitter: Tim Song Opened: 2020-07-03 Last modified: 2023-11-22

Priority: 0

View other active issues in [concept.convertible].

View all other issues in [concept.convertible].

View all issues with C++23 status.

Discussion:

There are no expressions of type cv-qualified void because any such expression must be prvalues and 7.2.2 [expr.type]/2 states:

If a prvalue initially has the type "cv T", where T is a cv-unqualified non-class, non-array type, the type of the expression is adjusted to T prior to any further analysis.

However, 18.4.4 [concept.convertible] p1 states:

Given types From and To and an expression E such that decltype((E)) is add_rvalue_reference_t<From>, convertible_to<From, To> requires E to be both implicitly and explicitly convertible to type To.

When From is cv-qualified void, E does not exist, yet we do want convertible_to<const void, void> to be modeled.

[2020-07-12; Reflector prioritization]

Set priority to 0 and status to Tentatively Ready after five votes in favour during reflector discussions.

[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4861.

  1. Modify 18.4.4 [concept.convertible] as indicated:

    -1- Given types From and To and an expression E such that decltype((E)) is add_rvalue_reference_t<From>whose type and value category are the same as those of declval<From>(), convertible_to<From, To> requires E to be both implicitly and explicitly convertible to type To. The implicit and explicit conversions are required to produce equal results.