================
@@ -230,3 +230,28 @@ void init_expr(int a, int b, int c) {
// OGCG: %[[C_PLUS_THREE:.*]] = add nsw i32 %[[C]], 3
// OGCG: store i32 %[[C_PLUS_THREE]], ptr %[[S_C]]
// OGCG: ret void
+
+void cxx_default_init_with_struct_field() {
+ struct Parent {
+ struct {
+ int a;
+ } child;
+ };
+ Parent p = Parent{};
+}
+
+// CIR: %[[P_ADDR:.*]] = cir.alloca !rec_Parent, !cir.ptr<!rec_Parent>, ["p",
init]
+// CIR: %[[P_ELEM_0_PTR:.*]] = cir.get_member %[[P_ADDR]][0] {name = "child"}
: !cir.ptr<!rec_Parent> -> !cir.ptr<!rec_anon2E0>
+// CIR: %[[CHILD_ELEM_0_PTR:.*]] = cir.get_member %[[P_ELEM_0_PTR]][0] {name =
"a"} : !cir.ptr<!rec_anon2E0> -> !cir.ptr<!s32i>
+// CIR: %[[CONST_0:.*]] = cir.const #cir.int<0> : !s32i
+// CIR: cir.store{{.*}} %3, %[[CHILD_ELEM_0_PTR]] : !s32i, !cir.ptr<!s32i>
----------------
andykaylor wrote:
```suggestion
// CIR: cir.store{{.*}} %[[CONST_0]], %[[CHILD_ELEM_0_PTR]] : !s32i,
!cir.ptr<!s32i>
```
https://github.com/llvm/llvm-project/pull/165994
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits