Title
convertible_to's description mishandles cv-qualified void
Status
c++23
Section
[concept.convertible]
Submitter
Tim Song

Created on 2020-07-03.00:00:00 last changed 13 months ago

Messages

Date: 2020-11-09.21:40:50

Proposed resolution:

This wording is relative to N4861.

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

Date: 2020-11-09.00:00:00

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

Date: 2020-07-15.00:00:00

[ 2020-07-12; Reflector prioritization ]

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

Date: 2020-07-03.00:00:00

There are no expressions of type cv-qualified void because any such expression must be prvalues and [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, [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.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2020-11-09 21:40:50adminsetmessages: + msg11582
2020-11-09 21:40:50adminsetstatus: ready -> wp
2020-07-12 17:33:57adminsetmessages: + msg11369
2020-07-12 17:33:57adminsetstatus: new -> ready
2020-07-05 16:20:24adminsetmessages: + msg11359
2020-07-03 00:00:00admincreate