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


106. Creating references to references during template deduction/instantiation

Section:Clause unknown  [unknown]    Status:CD1    Submitter:Bjarne Stroustrup    Date:unknown

[Moved to DR at 10/01 meeting.]

The main defect is in the library, where the binder template caneasily lead to reference-to-reference situations.

Proposed resolution (04/01):

  1. Add the following as paragraph 6 of 9.2.4 [dcl.typedef]:

    If a typedefTD names a type "reference tocv1S," an attempt to create the type"reference tocv2TD" creates the type"reference tocv12"S," wherecv12 is theunion of the cv-qualifierscv1 andcv2.Redundant qualifiers are ignored. [Example:

        int i;    typedef int& RI;    RI& r = i;          // rhas the type int&    const RI& r = i;    // rhas the type const int&
    end example]
  2. Add the following as paragraph 4 of 13.4.2 [temp.arg.type]:

    If atemplate-argument for atemplate-parameterT names a type "reference tocv1S,"an attempt to create the type "reference tocv2T"creates the type "reference tocv12S," wherecv12 is the union of the cv-qualifierscv1 andcv2. Redundant cv-qualifiers are ignored.[Example:

        template <class T> class X {        f(const T&);        /* ... */    };    X<int&> x;    // X<int&>::fhas the parameter type const int&
    end example]
  3. In 13.10.3 [temp.deduct] bullet 2.3 sub-bullet5, remove the indicated text:
    Attempting to createa reference to a reference type or areference tovoid.

(See also paper J16/00-0022 = WG21 N1245.)




[8]ページ先頭

©2009-2026 Movatter.jp