AaronBallman wrote:

> There is no const_cast, or casting away const in any form on this patch, so 
> how does it weaken const correctness?

When a function is marked as `const`, the implication is that calling the 
function should not lead to an underlying mutation. Given that this function is 
returning data it holds (`*Ctx`), the expectation is that the return value is 
also `const`-qualified. The typical pattern is to have an overload set as in 
the original code -- the non-const version can return something which can 
mutate, the const version can return something which doesn't allow for mutation 
without casting away the constness.

https://github.com/llvm/llvm-project/pull/130096
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to