Title
Overload resolution for references/pointers to noexcept functions
Status
open
Section
12.2.4.3 [over.ics.rank]
Submitter
Brian Bi

Created on 2023-10-05.00:00:00 last changed 6 months ago

Messages

Date: 2023-10-05.00:00:00

Consider:

  void f() noexcept {}

  void g(void (*)() noexcept) {}
  void g(void (&)()) {}

  int main() {
    g(f);     // error: ambiguous
  }

In contrast:

  void f() noexcept {}

  void g(void (*)()) {} 
  void g(void (&)()) {}      // #1

  int main() {
    g(f);    // OK, calls #1
  }

In both cases, binding void(&)() to void() noexcept is considered an identity conversion, without further disambiguation by 12.2.4.3 [over.ics.rank].

History
Date User Action Args
2023-10-05 00:00:00admincreate