http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56251



             Bug #: 56251

           Summary: no DW_AT_const_value  for static const member of a

                    template class

    Classification: Unclassified

           Product: gcc

           Version: 4.6.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: chihin...@oracle.com





If a static const member is in template class, there is no DW_AT_const_value

info,

compare these tvalue/value





< 2><0x0000005a>      DW_TAG_member

                        DW_AT_name                  "value"

                        DW_AT_decl_file             0x00000001 t.cc

                        DW_AT_decl_line             0x00000009

                        DW_AT_type                  <0x00000069>

                        DW_AT_external              yes(1)

                        DW_AT_declaration           yes(1)

                        DW_AT_const_value           200(as signed = -56)  <===

const value

< 1><0x00000069>    DW_TAG_const_type

                      DW_AT_type                  <0x0000002c>



---------------------------------------------------------------------------------



< 2><0x0000007a>      DW_TAG_member

                        DW_AT_name                  "tvalue"

                        DW_AT_decl_file             0x00000001 t.cc

                        DW_AT_decl_line             0x00000005

                        DW_AT_type                  <0x00000069>

                        DW_AT_external              yes(1)

                        DW_AT_declaration           yes(1)

                                                                    <==== no

const value

< 2><0x00000087>      DW_TAG_template_type_parameter

                        DW_AT_name                  "T0"





cat t.cc



#include <stdio.h>



template<class T0, class T1>

struct TCC {

        static const T0 tvalue = 100;

};



struct CC {

        static const int value = 200;

};



int main()

{

    CC cc;

    TCC<int, int> tcc;



        printf("tcc.value1 = %u \n", tcc.tvalue);

        printf("cc.value1 = %u \n", cc.value);

}

Reply via email to