Title
convertible_to and temporary-bound references
Status
new
Section
[concept.convertible]
Submitter
Tim Song

Created on 2021-09-28.00:00:00 last changed 1 month ago

Messages

Date: 2021-10-15.00:00:00

[ 2021-10-14; Reflector poll ]

Set priority to 3 after reflector poll.

Date: 2021-09-28.00:00:00

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.

We should rephrase this requirement to just perform the implicit conversion in words. Using a function handles the convert-void-to-void case, but the semantic requirements wording already excluded that case anyway.

History
Date User Action Args
2021-10-14 11:35:36adminsetmessages: + msg12164
2021-09-28 00:00:00admincreate