This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-08-11
1328. Conflict in reference binding vs overload resolutionSection: 9.5.4 [dcl.init.ref] Status: CD3 Submitter: Johannes Schaub Date: 2011-05-31[Moved to DR at the April, 2013 meeting.]
According to 12.2.2.7 [over.match.ref] paragraph 1, the determination of the candidate functions is based on whether 9.5.4 [dcl.init.ref] requires an lvalue result or an rvalue result. It is not sufficiently clear exactly what this means, particularly with respect to function lvalues and rvalues.
Proposed resolution (August, 2011):
Change 12.2.2.7 [over.match.ref] paragraph 1 as follows:
The conversion functions of S and its base classes are considered, except that for copy-initialization, only the non-explicit conversion functions are considered. Those that are not hidden within S and yield type “lvalue reference to cv2 T2” (when 9.5.4 [dcl.init.ref] requires an lvalue result initializing an lvalue reference or an rvalue reference to function) or “cv2 T2” or “rvalue reference to cv2 T2” (when 9.5.4 [dcl.init.ref] requires an rvalue result initializing an rvalue reference or an lvalue reference to function), where “cv1 T” is reference-compatible (9.5.4 [dcl.init.ref]) with “cv2 T2”, are candidate functions.
Change 12.2.4 [over.match.best] paragraph 1 as follows:
...
the context is an initialization by user-defined conversion... or if not that,
the context is an initialization by conversion function for direct reference binding (12.2.2.7 [over.match.ref]) of a reference to function type, the return type of F1 is the same kind of reference (i.e. lvalue or rvalue) as the reference being initialized, and the return type of F2 is not [Example:
template <class T> struct A { operator T&(); // #1 operator T&&(); // #2 }; typedef int Fn(); A<Fn> a; Fn& lf = a; // calls #1 Fn&& rf = a; // calls #2
—end example] or, if not that,
F1 is a non-template function...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4