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
", whereT
is a cv-unqualified non-class, non-array type, the type of the expression is adjusted toT
prior to any further analysis.
However, 18.4.4 [concept.convertible] p1 states:
Given types
From
andTo
and an expressionE
such thatdecltype((E))
isadd_rvalue_reference_t<From>
,convertible_to<From, To>
requiresE
to be both implicitly and explicitly convertible to typeTo
.
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.
Modify 18.4.4 [concept.convertible] as indicated:
-1- Given types
From
andTo
and an expressionE
such thatwhose type and value category are the same as those ofdecltype((E))
isadd_rvalue_reference_t<From>
declval<From>()
,convertible_to<From, To>
requiresE
to be both implicitly and explicitly convertible to typeTo
. The implicit and explicit conversions are required to produce equal results.