[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
Tue Jun 4 12:19:38 PDT 2024


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

@Sirraide 
This addition caused few more tests to fail. It's for the `++b` part in tests (maybe there's a different way to go about this), apart from that, looks fine to me. Let me know your thoughts.

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


More information about the cfe-commits mailing list