The `std::negation<std::is_const<C>>` check here seems semantically inaccurate; we should care about whether the container provides mutable element access, not the constness of the container itself. This was already being checked but was previously being dropped prior to the change from `const C&` to `C&` in https://github.com/llvm/llvm-project/pull/181190. That was sufficient in itself to fix the referenced issue https://github.com/llvm/llvm-project/issues/181176 --------- Signed-off-by: Eric Feng <Eric.Feng@amd.com>