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

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 12:22:51 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();
----------------
Sirraide wrote:

> This addition caused few more tests to fail. 

Yes, that much is expected because the tests expect that certain diagnostics (and only those diagnostics) are emitted. You will probably have to update several tests to include this diagnostic because of that. Just make sure that the failures actually make sense (i.e. they’re failing because we’re adding this here, which is expected; we previously weren’t emitting this, and now we are) and that they aren’t something unrelated that your changes broke somehow.

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


More information about the cfe-commits mailing list