Title
Overload resolution with implicit and explicit object member functions
Status
review
Section
12.2.4.1 [over.match.best.general]
Submitter
Corentin Jabot

Created on 2023-08-08.00:00:00 last changed 5 days ago

Messages

Date: 2023-09-16.05:22:26

Proposed resolution:

Change in 12.2.4.1 [over.match.best.general] bullet 2.6 as follows:

  • ...
  • F1 and F2 are non-template functions with the same parameter-type-lists non-object-parameter-type-lists (9.3.4.6 [dcl.fct]) and, if they are member functions, the same types for their object parameters, and F1 is more constrained than F2 according to the partial ordering of constraints described in 13.5.5 [temp.constr.order], or if not that,
  • ...
Date: 2023-09-16.05:22:26

Consider:

  template <typename T = int>
  struct S {
    constexpr void f();                      // #1
    constexpr void f(this S&) requires true; // #2
  };

  void test() {
    S<> s;
    s.f();                 // #3
  }

With the current rules, the call at #3 is ambiguous, even though #2 is more constrainted.

History
Date User Action Args
2023-09-16 05:22:26adminsetmessages: + msg7434
2023-09-16 05:22:26adminsetstatus: open -> review
2023-08-08 00:00:00admincreate