Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


322. Deduction of reference conversions

Section:13.10.3.4  [temp.deduct.conv]    Status:CD1    Submitter:Jason Merrill    Date:14 Nov 2001

[Voted into WP at April 2003 meeting.]

Consider:

  struct S {    template <class T> operator T& ();  };  int main ()  {    S s;    int i = static_cast<int&> (s);  }
13.10.3.4 [temp.deduct.conv] says that we strip thereference fromint&, but doesn't sayanything aboutT&. As a result,P (T&)andA (int) have incompatible formsand deduction fails.

Proposed Resolution (4/02):

Change the last chunk of 13.10.3.4 [temp.deduct.conv] paragraph 2 from

IfA is a cv-qualified type, the top level cv-qualifiers ofA's type are ignored for type deduction. IfA is a reference type, the type referred to byA is used for type deduction.
to
IfA is a cv-qualified type, the top level cv-qualifiers ofA's type are ignored for type deduction. IfA is a reference type, the type referred to byA is used for type deduction. IfP is a reference type, the type referred to byP is used for type deduction.




[8]ページ先頭

©2009-2026 Movatter.jp