DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



130411.1 Paul Robinson Values for non-type template parameter Clarification Replaced Paul Robinson


Section 5.5.8, pg 93
Currently, DW_TAG_template_value_parameter has a DW_AT_const_value attribute giving the
constant value of the actual parameter used to instantiate the template.

However, "value parameter" doesn't adequately describe what are actually "non-type"
parameters.  DW_AT_const_value really handles only integral/enumerated parameters;
more complex non-type parameters need something more appropriate.

I tried the following with GCC 4.7.2:

template <int X> struct A { int a; };
template <int &Y> struct B { int b; };
template <int Z(int)> struct C { int c; };
int i = 0;
int foo(int j) { return 2 * j; }
A<4> instanceA;
B<&i> instanceB;
C<foo> instanceC;

It produces DW_AT_const_value in the type tag for instanceA, and uses DW_AT_location 
for the other two.  We should probably bless this usage.

---
Replace by 130412.1


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.