Title
Incorrect note about implicit conversion sequence
Status
c++23
Section
12.2.2.2.3 [over.call.object]
Submitter
CA

Created on 2022-11-03.00:00:00 last changed 9 months ago

Messages

Date: 2022-11-08.20:25:22

Proposed resolution (approved CWG 2022-11-08):

Change in 12.2.2.2.3 [over.call.object] paragraph 3 as follows:

[Note 1: When comparing the call against the function call operators, the implied object argument is compared against the object parameter of the function call operator. When comparing the call against a surrogate call function, the implied object argument is compared against the first parameter of the surrogate call function. The conversion function from which the surrogate call function was derived will be used in the conversion sequence for that parameter since it converts the implied object argument to the appropriate function pointer or reference required by that first parameter.end note]
Date: 2022-11-27.21:00:25
P2720R0 comment CA 064

[Accepted as a DR at the November, 2022 meeting.]

Contrary to the note in the subject paragraph, overload resolution in selecting a surrogate call function can prefer a different conversion operator for the implicit conversion sequence because the conversion function from which the surrogate call function was derived is not the best viable function.

For example, noting that surrogate call functions are not generated from conversion function templates, the single surrogate call function derived from the (non-template) conversion function below is the sole candidate for the call; however, the specialization of the conversion function template is a better candidate f or the implicit conversion sequence during overload resolution:

  using ff = int (*)(int);
  constexpr int ffimpl0(int x) {
   return x;
  }
  constexpr int ffimpl1(int x) {
   return x + 1;
  }
  struct A {
   template <typename T> constexpr operator T() const { return ffimpl0; }
   constexpr operator ff() const volatile { return ffimpl1; }
  };
  char x[A()(42.f)];
  extern char x[43];
History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: drwp -> open
2023-02-18 18:43:04adminsetstatus: dr -> drwp
2022-11-25 05:14:04adminsetstatus: nb -> dr
2022-11-08 20:22:53adminsetstatus: open -> nb
2022-11-08 20:22:53adminsetstatus: open -> open
2022-11-08 20:22:53adminsetstatus: open -> open
2022-11-08 20:22:53adminsetstatus: open -> open
2022-11-08 13:33:47adminsetstatus: nb -> open
2022-11-08 13:33:47adminsetstatus: nb -> nb
2022-11-08 13:33:47adminsetstatus: nb -> nb
2022-11-08 13:33:47adminsetmessages: + msg6975
2022-11-03 00:00:00admincreate