Hello all,

When I compile

```
template <typename T>
struct Cls {
 static const int v = 0;
};

template <typename T>
int constexpr Cls_v = Cls<T>::v;

int func() {
 return Cls_v<int> + Cls_v<float>;
}
```

using `g++ -c main.cpp -o main.o -g`, I see two indistinguishable DIEs in the 
generated debug info:

```
< 1><0x0000003a> DW_TAG_variable
 DW_AT_name Cls_v
 DW_AT_decl_file 0x00000001
 DW_AT_decl_line 0x00000007
 DW_AT_decl_column 0x0000000f
 DW_AT_type <0x00000035>
 DW_AT_const_expr yes(1)
 DW_AT_location len 0x0009: 0x030000000000000000:
 DW_OP_addr 0x00000000

< 1><0x0000004d> DW_TAG_variable
 DW_AT_name Cls_v
 DW_AT_decl_file 0x00000001
 DW_AT_decl_line 0x00000007
 DW_AT_decl_column 0x0000000f
 DW_AT_type <0x00000035>
 DW_AT_const_expr yes(1)
 DW_AT_location len 0x0009: 0x030400000000000000:
 DW_OP_addr 0x00000004
```

Clang, however, generates DW_TAG_template_type_parameter children for these 
DIEs too:

```
< 1><0x0000003c> DW_TAG_variable
 DW_AT_name (indexed string: 0x00000003)Cls_v
 DW_AT_type <0x00000033>
 DW_AT_decl_file 0x00000001 /main.cpp
 DW_AT_decl_line 0x00000007
 DW_AT_const_value 0
< 2><0x00000045> DW_TAG_template_type_parameter
 DW_AT_type <0x0000004c>
 DW_AT_name (indexed string: 0x00000005)T
```

I was wondering if this is intentional or it’s just forgotten to be generated.

Thanks,
Nima

Reply via email to