DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



090106.1 Kendrick Wong Support C++0x r-value reference Enhancement Accepted Kendrick Wong


Background
----------

C++0x adds R-Value references.  An article describing these
can be found at http://www.artima.com/cppsource/rvalue.html.
An rvalue reference behaves just like an lvalue reference 
except that it can bind to a temporary (an rvalue).

Overview
--------

L-value reference is indicated by a single ampersand: &. 
(DW_TAG_reference_type)
R-value reference is indicated by two ampersands: &&.

The R-value reference can be passed into function as non-const 
values, thus allowing an object to modify them.  This is useful 
for creating move semantics, so r-value can be accepted and 
returned without calling the copy constructor.

   A&  ref1 = A();  // Error!
   A&& ref2 = A();  // Ok

Both lvalue reference and rvalue reference can participate in
overloading.


Proposed Changes to the DWARF Specification
-------------------------------------------

New DWARF tag:
|DW_TAG_rvalue_reference_type | 0x41 | C++0x R-value reference type |

Allowable attributes: (modeled after DW_TAG_reference_type)
* DW_AT_address_class
* DW_AT_allocated
* DW_AT_associated
* DW_AT_data_location
* DW_AT_name
* DW_AT_sibling
* DW_AT_type

Example
-------

   A&& ref2;

   <1><  xxx>      DW_TAG_class_type
                   DW_AT_name                  A
   <1><  yyy>      DW_TAG_rvalue_reference_type
                   DW_AT_type                  <xxx>
   <1><  zzz>      DW_TAG_variable
                   DW_AT_name                  ref2
                   DW_AT_type                  <yyy>

---
Accepted Feb 3, 2009.  Editor will assign TAG values.  


All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2017 by DWARF Standards Committee.