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

2024-11-11


2031. Missing incompatibility for &&

Section: C.6.3  [diff.cpp03.expr]     Status: CD4     Submitter: Melissa Mears     Date: 2014-10-31

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

The introduction of rvalue references in C++11 changed the interpretation of some previously well-formed examples such as the following:

  struct Struct { template <typename T> operator T(); };
  bool example_1 = new int && false;               // #1
  bool example_2 = &Struct::operator int && false; // #2

Previously the && was interpreted as an operator, while it is now part of a type-name. However, this change is not mentioned in Annex Clause Annex C [diff].

Proposed resolution (May, 2015):

Add the following as a new subsection in C.6.3 [diff.cpp03.expr]:

7.6.15 [expr.log.or]
Change: && is valid in a type-name
Rationale: Required for new features
Effect on original feature: Valid C++ 2003 code may fail to compile or produce different results in this International Standard, as the following example illustrates:

  bool b1 = new int && false;           // previously false, now ill-formed
  struct S { operator int(); };
  bool b2 = &S::operator int && false;  // previously false, now ill-formed