This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1401. Similar types and reference compatibility

Section: 9.4.4  [dcl.init.ref]     Status: CD3     Submitter: Daniel Krügler     Date: 2011-10-03

[Moved to DR at the October, 2012 meeting.]

The definition of reference-compatible types in 9.4.4 [dcl.init.ref] paragraph 4 allows the types to differ in top-level cv-qualification, but it does not encompass the deeper added cv-qualification permitted for “similar types” (7.3.6 [conv.qual]). This seems surprising and could lead to errors resulting from the fact that the reference will be bound to a temporary and not to the original object in the initializer.

Proposed resolution (February, 2012):

  1. Change 9.4.4 [dcl.init.ref] paragraph 4 as follows:

  2. Given types “cv1 T1” and “cv2 T2,” “cv1 T1” is reference-related to “cv2 T2” if T1 is the same type as T2, or T1 is a base class of T2. “cv1 T1” is reference-compatible with “cv2 T2” if T1 is reference-related to T2 and cv1 is the same cv-qualification as, or greater cv-qualification than, cv2. For purposes of overload resolution, cases for which cv1 is greater cv-qualification than cv2 are identified as reference-compatible with added qualification (see [over.ics.rank]). In all cases...
  3. Delete [over.ics.ref] paragraph 5:

  4. The binding of a reference to an expression that is reference-compatible with added qualification influences the rank of a standard conversion; see [over.ics.rank] and 9.4.4 [dcl.init.ref].

    [Drafting note: CWG decided not to make a substantive change for this issue, but the investigation discovered that the term defined by these two citations is not actually used and could be removed.]