Movatterモバイル変換


[0]ホーム

URL:


Issue 1328 - WG21 CWG Issues
Title
Conflict in reference binding vs overload resolution
Status
cd3
Section
9.5.4 [dcl.init.ref]
Submitter
Johannes Schaub

Created on2011-05-31.00:00:00 last changed143 months ago

Messages

msg4409 (view)
Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

msg3871 (view)
Date: 2011-08-15.00:00:00

Proposed resolution (August, 2011):

  1. Change 12.2.2.7 [over.match.ref] paragraph 1 as follows:

    • The conversion functions ofS and its base classesare considered, except that for copy-initialization, only thenon-explicit conversion functions are considered. Those that are nothidden withinS and yield type “lvalue reference tocv2T2” (when9.5.4 [dcl.init.ref]requires an lvalue resultinitializing an lvalue referenceor an rvalue reference to function) or “cv2T2” or “rvalue reference tocv2T2” (when9.5.4 [dcl.init.ref] requires anrvalue resultinitializing an rvalue reference or an lvaluereference to function), where “cv1T” is reference-compatible (9.5.4 [dcl.init.ref])with “cv2T2”, are candidatefunctions.

  2. Change 12.2.4 [over.match.best] paragraph 1 as follows:

    • ...

    • the context is an initialization by user-defined conversion... orif not that,

    • the context is an initialization by conversion functionfor direct reference binding (12.2.2.7 [over.match.ref]) of areference to function type, the return type ofF1 is the samekind of reference (i.e. lvalue or rvalue) as the reference beinginitialized, and the return type ofF2 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...

msg3503 (view)
Date: 2012-09-24.00:00:00

According to 12.2.2.7 [over.match.ref] paragraph 1, thedetermination of the candidate functions is based on whether9.5.4 [dcl.init.ref] requires an lvalue result or an rvalueresult. It is not sufficiently clear exactly what this means,particularly with respect to function lvalues and rvalues.

History
DateUserActionArgs
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: +msg4409
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-09-24 00:00:00adminsetmessages: +msg3871
2012-02-27 00:00:00adminsetstatus: tentatively ready -> ready
2012-01-17 00:00:00adminsetstatus: review -> tentatively ready
2011-05-31 00:00:00admincreate

[8]ページ先頭

©2009-2025 Movatter.jp