1/*
2  Origin: PR debug/45024
3  { dg-options "-g -dA -fno-merge-debug-strings -fno-debug-types-section" }
4  { dg-do compile }
5*/
6
7struct S {
8  template<typename Z> struct T { };
9};
10
11S::T<int> tval;
12
13/*
14We want to express that the DIE of S::T<int> must be a child of the DIE of S, like in assembly this output:
15
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
32
33Hence the slightly odd regexp:
34
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\]*" } }
36
37 */
38