Endilll wrote: I think I should post here an example from our codebase that made me think twice about this PR.
First, there's a `MultiLevelTemplateArgumentList` (MLTAL for short), which I believe is one of the backbones of our template engine: https://github.com/llvm/llvm-project/blob/42b4be6d7b896fcf2ef16818862a5be3e98ca791/clang/include/clang/Sema/Template.h#L76-L79 As you can see, actual argument list is defined as an `ArrayRef`, which is a view type that propagates constness to its elements. Then, there's a `SetArgument` function: https://github.com/llvm/llvm-project/blob/42b4be6d7b896fcf2ef16818862a5be3e98ca791/clang/include/clang/Sema/Template.h#L196-L204 `const_cast` here is a relatively recent addition, and I checked out with @erichkeane that the use case (pack expansion) is legit. According to the approach you're suggesting, the one who wrote this `const_cast` should instead refactor the MLTAL to use `llvm::MutableArrayRef`. I tried, pretty hard, but ultimately failed. The change turned out to be touching every corner of our template engine, with no end in sight. While you're claiming that annotating things with `const` should stop digging the hole, this is not necessarily the case. That's why we're asking this change to be done with a "does it make sense for this thing to be `const`?" attitude. https://github.com/llvm/llvm-project/pull/93493 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits