[clang] [CIR] Prepare a 'this' for CXXDefaultInitExprs (PR #165994)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 3 15:58:18 PST 2025


================
@@ -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() {
----------------
andykaylor wrote:

It looks to me like this test will pass even without the change in this PR. I think you need something like this:

```
  struct Parent {
    int getA();
    int a = getA();
    struct {
      int b;
    } child;
  };
```
The call to `getA()` in the default initializer requires a `this` parameter. I don't think the child struct is needed.

https://github.com/llvm/llvm-project/pull/165994


More information about the cfe-commits mailing list