Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / debug / dwarf2 / nested-2.C
blob3e6f6b5912b9b1fb108a00749af93605ad3eb6cd
1 /*
2   Origin: PR debug/45024
3   { dg-options "-g -dA -fno-merge-debug-strings" }
4   { dg-do compile }
5 */
7 struct S {
8   template<typename Z> struct T { };
9 };
11 S::T<int> tval;
14 We want to express that the DIE of S::T<int> must be a child of the DIE of S, like in assembly this output:
16         .uleb128 0x2    # (DIE (0x9e) DW_TAG_structure_type)
17         .ascii "S\0"    # DW_AT_name
18         .byte   0x1     # DW_AT_byte_size
19         .byte   0x1     # DW_AT_decl_file (../../prtests/test-PR45024.cc)
20         .byte   0x1     # DW_AT_decl_line
21         .long   0xbc    # DW_AT_sibling
22         .uleb128 0x3    # (DIE (0xa8) DW_TAG_structure_type)
23         .ascii "T<int>\0"       # DW_AT_name
24         .byte   0x1     # DW_AT_byte_size
25         .byte   0x1     # DW_AT_decl_file (../../prtests/test-PR45024.cc)
26         .byte   0x2     # DW_AT_decl_line
27         .uleb128 0x4    # (DIE (0xb3) DW_TAG_template_type_param)
28         .ascii "Z\0"    # DW_AT_name
29         .long   0xbc    # DW_AT_type
30         .byte   0       # end of children of DIE 0xa8
31         .byte   0       # end of children of DIE 0x9e
33 Hence the slightly odd regexp:
35   { dg-final { scan-assembler "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"S\\\\0\"\[ \t\]+\(\[@|#;!\]|//?\)\[ \t\]+DW_AT_name\[\n\r\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"T<int>\\\\0\"\[ \t\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_template_type_param\\)\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\(\[@|#;!\]|//?\)\[ \t\]+end of children of DIE\[^\n\r\]*\[\n\r\]+\[^\n\r\]*end of children of DIE\[^\n\r\]*" } }
37  */