Title
Binding a reference to an rvalue bit-field
Status
cd3
Section
9.4.4 [dcl.init.ref]
Submitter
Nikolay Ivchenkov

Created on 2011-04-14.00:00:00 last changed 131 months ago

Messages

Date: 2012-02-15.00:00:00

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

Date: 2011-08-15.00:00:00

Proposed resolution (August, 2011):

Change the indicated sub-bullet of 9.4.4 [dcl.init.ref] paragraph 5 as follows:

  • is an xvalue (but is not a bit-field), class prvalue, array prvalue or function lvalue and “cv1 T1” is reference-compatible with “cv2 T2”, or

Date: 2012-09-24.00:00:00

Consider the following example:

  struct X {
    unsigned bitfield : 4;
  };
  int main() {
    X x = { 1 };
    unsigned const &ref = static_cast<X &&>(x).bitfield;
  }

According to 9.4.4 [dcl.init.ref] paragraph 5, ref is bound to the bit-field xvalue.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2012-11-03 00:00:00adminsetstatus: dr -> drwp
2012-09-24 00:00:00adminsetmessages: + msg4008
2012-02-27 00:00:00adminsetmessages: + msg3818
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-04-14 00:00:00admincreate