Title
Erroneous reference initialization in example
Status
cd4
Section
9.2.9.3 [dcl.type.simple]
Submitter
Niels Dekker

Created on 2012-12-30.00:00:00 last changed 86 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2013-04-15.00:00:00

Proposed resolution (April, 2013):

Change the example in 9.2.9.3 [dcl.type.simple] paragraph 4 as follows:

  const int&& foo();
  int i;
  struct A { double x; };
  const A* a = new A();
  decltype(foo()) x1 = i 17;     // type is const int&&
  decltype(i) x2;                // type is int
  decltype(a->x) x3;             // type is double
  decltype((a->x)) x4 = x3;      // type is const double&
Date: 2012-12-30.00:00:00

The example in 9.2.9.3 [dcl.type.simple] paragraph 4 reads, in part,

  const int&& foo();
  int i;
  decltype(foo()) x1 = i; // type is const int&&

The initialization is an ill-formed attempt to bind an rvalue reference to an lvalue.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5361
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetstatus: review -> ready
2013-05-03 00:00:00adminsetmessages: + msg4318
2013-05-03 00:00:00adminsetstatus: drafting -> review
2012-12-30 00:00:00admincreate