convertible_to
and temporary-bound referencesSection: 18.4.4 [concept.convertible] Status: New Submitter: Tim Song Opened: 2021-09-28 Last modified: 2021-10-23
Priority: 3
View other active issues in [concept.convertible].
View all other issues in [concept.convertible].
View all issues with New status.
Discussion:
The semantic requirements of convertible_to
express implicit
conversion by means of a function:
To test(FromR (&f)()) { return f(); }
and it requires that static_cast<To>(f())
be equal to test(f)
for some
equality-preserving function f
. However, when To
is a reference type
but FromR
is such that the conversion binds the reference to a temporary, the
static_cast
is valid but test(f)
would produce a dangling reference.
void
-to-void
case, but the semantic requirements
wording already excluded that case anyway.
[2021-10-14; Reflector poll]
Set priority to 3 after reflector poll.
Proposed resolution: