11
11
// CHECK-LL: struct Generalization definition
12
12
// CHECK-LL: load 'double'
13
13
// CHECK-LL: __pp_specialization_type 'int'
14
- // CHECK-LL: %struct.__pp_struct_Generalization__Base1 = type { %struct.Generalization, %struct.Base1 }
15
- // CHECK-LL: %struct.Generalization = type { double, i32 }
14
+
16
15
// CHECK-LL: %struct.Base1 = type { i32 }
17
- // CHECK-LL: %struct.__pp_struct_Generalization__Base2 = type { %struct.Generalization, %struct.Base2 }
18
16
// CHECK-LL: %struct.Base2 = type { i32 }
19
- // CHECK-LL: double @check_gen(ptr noundef byval(%struct.__pp_struct_Generalization__Base1) align 8 %gb)
17
+ // CHECK-LL: %struct.Generalization = type { double, i32 }
18
+ // CHECK-LL: %struct.__pp_struct_Generalization__Base1 = type { %struct.Generalization, %struct.Base1 }
19
+ // CHECK-LL: %struct.__pp_struct_Generalization__Base2 = type { %struct.Generalization, %struct.Base2 }
20
+
21
+ // CHECK-LL: double @check_gen_b1(ptr noundef byval(%struct.__pp_struct_Generalization__Base1) align 8 %gb)
22
+ // CHECK-LL: double @check_gen_b2(ptr noundef byval(%struct.__pp_struct_Generalization__Base2) align 8 %gb)
20
23
21
24
// CHECK-AST: |-RecordDecl {{.*}} struct Base1 definition
22
25
// CHECK-AST-NEXT:| `-FieldDecl {{.*}} i 'int'
@@ -36,15 +39,31 @@ struct Base1 { int i; };
36
39
struct Base2 { int j ; };
37
40
struct Generalization { double load ; } < Base1 , Base2 > ;
38
41
39
- double check_gen (struct Generalization < Base1 > gb ) { return gb .__pp_head .load ; }
42
+ int get_b1_field (struct Base1 b ) { return b .i ; }
43
+ int get_b2_field (struct Base2 b ) { return b .j ; }
40
44
double foo (struct Generalization g ) { return g .load ; }
41
45
42
46
int get_tag1 (struct __pp_struct_Generalization__Base1 b )
43
47
{ return b .__pp_head .__pp_specialization_type ; }
44
48
int get_tag2 (struct __pp_struct_Generalization__Base2 b )
45
49
{ return b .__pp_head .__pp_specialization_type ; }
50
+
46
51
struct Generalization get_gen1 (struct __pp_struct_Generalization__Base1 b ) { return b .__pp_head ; }
47
52
struct Generalization get_gen2 (struct __pp_struct_Generalization__Base2 b ) { return b .__pp_head ; }
48
53
49
54
struct Base1 get_b1 (struct __pp_struct_Generalization__Base1 b ) { return b .__pp_tail ; }
50
55
struct Base2 get_b2 (struct __pp_struct_Generalization__Base2 b ) { return b .__pp_tail ; }
56
+
57
+ double check_gen_b1 (struct Generalization < Base1 > gb ) { return gb .__pp_head .load ; }
58
+ double check_gen_b2 (struct Generalization < Base2 > gb ) { return gb .__pp_head .load ; }
59
+
60
+ int get_spec_field1 (struct Generalization < Base1 > gb ) { return gb .__pp_tail .i ; }
61
+ int get_spec_field2 (struct Generalization < Base2 > gb ) { return gb .__pp_tail .j ; }
62
+
63
+ int test_vars () {
64
+ struct Generalization < Base1 > gb1 ;
65
+ gb1 .__pp_tail .i = 3 ;
66
+ struct Generalization < Base2 > gb2 ;
67
+ gb2 .__pp_tail .j = 5 ;
68
+ return get_spec_field1 (gb1 ) + get_spec_field2 (gb2 );
69
+ }
0 commit comments