Title
Overload resolution involving lvalue transformation and qualification conversion
Status
open
Section
12.2.4.3 [over.ics.rank]
Submitter
Vincent X

Created on 2024-11-10.00:00:00 last changed 1 week ago

Messages

Date: 2024-11-10.00:00:00

(From submission #636.)

The following example in 12.2.4.3 [over.ics.rank] bullet 3.2.5 is not in harmony with the normative rules:

  int g(const int*);         //#1
  int g(const volatile int* const&); //#3
  int* p;
  int k = g(p);          // calls g(const int*)

The invocation of #1 requires an lvalue-to-rvalue conversion followed by a qualification conversion; #2 requires only a qualification conversion.

Possible resolution:

Change in 12.2.4.3 [over.ics.rank] bullet 3.2.5 as follows:

  • ...
  • S1 and S2 differ only in their qualification conversion (7.3.6 [conv.qual]), ignoring any Lvalue Transformation, and yield similar types T1 and T2, respectively (where a standard conversion sequence that is a reference binding is considered to yield the cv-unqualified referenced type), where T1 and T2 are not the same type, and const T2 is reference-compatible with T1 (9.4.4 [dcl.init.ref]) ...
History
Date User Action Args
2024-11-10 00:00:00admincreate