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

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 5 05:21:52 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:

Yup, the diagnostic should not be issued in this case since `j` is not of pointer type; that’s pretty much exactly what I meant by ‘make sure that the failures actually make sense’.

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


More information about the cfe-commits mailing list