[clang] [clang][CFG] Sequence RHS before LHS for overloaded assignment operators in CFG to match C++17 rules (PR #181113)

Alex Wang via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 12 12:49:06 PST 2026


aeft wrote:

> Good catch. Was there any failing test through which you found this ? 

No. I will add a new test:
```cpp
struct A {
  A();
  ~A();
  A &operator=(const A &);
};

struct B {
  B();
  ~B();
};

struct C {
  C();
  ~C();
};

A &getLHS(const B &);
A &getRHS(const C &);

// CHECK-LABEL: void test_temp_dtor_order()
// CHECK:       ~B() (Temporary object destructor)
// CHECK-NEXT:  ~C() (Temporary object destructor)
void test_temp_dtor_order() {
  getLHS(B()) = getRHS(C());
}
```

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


More information about the cfe-commits mailing list