Issue 161031.4: C++ static data members, C++17 inline variables

Author: Jakub Jelinek
Champion: Jakub Jelinek
Date submitted: 2016-10-31
Date revised:
Date closed:
Type: Editorial
Status: Rejected
DWARF Version: 5
Section Appendix A, pg 258
For DW_TAG_variable we list lots of attributes that aren't listed for
DW_TAG_member, in particular:
DW_AT_alignment
DW_AT_const_expr
DW_AT_const_value
DW_AT_endianity
DW_AT_external
DW_AT_linkage_name
DW_AT_location
DW_AT_segment
DW_AT_specification
DW_AT_start_scope

For C++98 .. C++14, I think at least DW_AT_const_value and DW_AT_const_expr
should be listed as allowed on DW_TAG_member, if we have say:

struct A
{
  static constexpr int a = 9;
} a;

then even when we don't have a definition of A::a in the current TU, it 
is still desirable to tell the consumers that A::a is constexpr and what 
constant value it has - if such a static data member is never odr-used, 
it might not have the definition anywhere.

For C++17, I believe we need far more attributes than that.  First of 
all, variables can be explicitly or implicitly inline, so we should allow 
DW_AT_inline DW_INL_declared_inlined on variables with explicit inline 
keyword and DW_AT_inline DW_INL_inlined for the implicit ones (static 
constexpr data members).

And, as inline (explicitly or implicitly) static data members have their 
definitions in the class rather than somewhere else, we need to allow

DW_AT_alignment
DW_AT_const_expr
DW_AT_const_value
DW_AT_endianity
DW_AT_external
DW_AT_inline
DW_AT_linkage_name
DW_AT_location
DW_AT_segment
on DW_TAG_member (in addition to DW_TAG_inline on DW_TAG_variable) - I think:
DW_AT_specification
DW_AT_start_scope
don't make sense for DW_TAG_member - start_scope because static data members 
are global variables and thus should be in scope everywhere.

--

Rejected 1/3/2017.
See issue 161118.1 regarding DW_TAG_member.  Detailed proposal needed for C++17.