[clang] [clang] Fix-it hint for `++this` -> `++*this` when deref is modifiable (PR #94159)

Rajveer Singh Bharadwaj via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 08:38:06 PDT 2024


================
@@ -13367,6 +13367,21 @@ static void DiagnoseConstAssignment(Sema &S, const Expr *E,
         if (!DiagnosticEmitted) {
           S.Diag(Loc, diag::err_typecheck_assign_const)
               << ExprRange << ConstVariable << VD << VD->getType();
+          ExprResult Deref;
+          Expr *TE = const_cast<Expr *>(E);
----------------
Rajveer100 wrote:

I think it would be more prone to modifications due to it being non `const` and being used in many other contexts, maybe we could leave it as it is for now?

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


More information about the cfe-commits mailing list