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

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 06:27:14 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);
----------------
Sirraide wrote:

Can we make the `E` parameter to `DiagnoseConstAssignment` non-`const` instead? If we don’t have to change too many other things for that, then I’d do that, otherwise this is fine too.

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


More information about the cfe-commits mailing list