[clang] [Clang] Sequence the object argument of an overloaded operator[] or operator() first (PR #215479)
Xavier Roche via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 10:48:46 PDT 2026
xroche wrote:
> Oh, I see. I guess Microsoft decided that changing the destruction order would be an ABI break, and therefore shouldn't be done. Maybe we should follow MSVC here. How hard would it be to match MSVC for operator[] (use left-to-right if no arguments have a non-trivial destructor, use right-to-left otherwise)?
>
> It's interesting that they intentionally didn't fix operator(); not clear why.
I tried that rule with [MSVC 19.51](https://godbolt.org/z/rcqMEj8jn): `CopyOnly` has a trivial destructor but gets reordered, while `DtorOnly` has a non-trivial destructor but stays left-to-right. On x86, `CopyOnly` even uses a mixed order, so a destructor check cannot match MSVC.
https://github.com/llvm/llvm-project/pull/215479
More information about the cfe-commits
mailing list