https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90526

            Bug ID: 90526
           Summary: Missing DW_AT_const_value for constexpr field
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tromey at gcc dot gnu.org
  Target Milestone: ---

This test case comes from https://sourceware.org/bugzilla/show_bug.cgi?id=20020

Consider:

template<typename _Tp>
struct foo
{
  static constexpr bool is_always_lock_free = true;
};


int main()
{
  foo<int> p;
  return 0;
}


Using a recent trunk gcc: gcc (GCC) 10.0.0 20190515 (experimental),
compiling with -g, and looking at the DWARF, I see this DIE for
foo<int>::is_always_lock_free:

 <2><3a>: Abbrev Number: 3 (DW_TAG_member)
    <3b>   DW_AT_name        : (indirect string, offset: 0x0):
is_always_lock_free
    <3f>   DW_AT_decl_file   : 1
    <40>   DW_AT_decl_line   : 4
    <41>   DW_AT_decl_column : 25
    <42>   DW_AT_type        : <0x57>
    <46>   DW_AT_external    : 1
    <46>   DW_AT_declaration : 1
    <46>   DW_AT_const_expr  : 1


Notice no DW_AT_const_value.

However, I change foo to not be a template, I get:

 <2><3a>: Abbrev Number: 3 (DW_TAG_member)
    <3b>   DW_AT_name        : (indirect string, offset: 0x15):
is_always_lock_free
    <3f>   DW_AT_decl_file   : 1
    <40>   DW_AT_decl_line   : 3
    <41>   DW_AT_decl_column : 25
    <42>   DW_AT_type        : <0x4f>
    <46>   DW_AT_external    : 1
    <46>   DW_AT_declaration : 1
    <46>   DW_AT_const_value : 1
    <47>   DW_AT_const_expr  : 1



I think the template case should also emit a const_value

Reply via email to