DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



131217.1 Paul Robinson C++ "auto" return type Enhancement Accepted Paul Robinson


Section 3.3.2, 5.2, 5.7.7, pg 59, 85, 98
C++14 will allow using the "auto" keyword in place of the return type of a function
declaration.  The actual return type will be deduced from the definition, based on the
type of expressions used in the "return" statement(s).  If such a function is a class
method, and we want class descriptions across compilation units to be consistent (which
allows them to be put into separate type units), then we need a way to describe "auto".

I've written this assuming that "auto" can be used this way only on member functions.
Can it also be used on standalone functions?  I'm not sure we have the same kind of
declaration/specification pairing for standalone functions.


3.3.2 Subroutine and Entry Point Return Types (p.59)

Current non-normative text says "void" return type should omit the DW_AT_type 
attribute.  So, doing the same thing for "auto" would be misleading.

Add non-normative paragraph:

Debugging information entries for declarations of C++ member functions with
an "auto" return type specifier should use an unspecified type entry (see 
Section 5.2). The debugging information entry for the corresponding definition
should provide the deduced return type.  This practice causes the description of
the containing class to be consistent across compilation units, allowing the class
declaration to be placed into a separate type unit if desired.


5.2 Unspecified Type Entries (p.85)

Add new paragraph:

C++ permits using the "auto" specifier for the return type of a member function
declaration.  The actual return type is deduced based on the definition of the 
function, so it may not be known when the function is declared.  The language 
implementation can provide an unspecified type entry with the name "auto" which 
can be referenced by the return type attribute of a function declaration entry.  
When the function is later defined, the DW_TAG_subprogram entry for the definition
includes a reference to the actual return type.


5.7.7 Member Function Entries (p.98)

Last sentence currently reads:
  In particular, such entries do not need to contain attributes for the name or
  return type of the function member whose definition they represent.

Replace that with:
  In particular, such entries do not need to contain a name attribute giving
  the name of the function member whose definition they represent.  Similarly,
  such entries do not need to contain a return type attribute, unless the
  return type on the declaration was unspecified (e.g., the declaration used
  the C++ "auto" return type specifier).

--

1/21/2014 - Accepted.


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.