================ @@ -13367,6 +13367,20 @@ 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); + { + Sema::TentativeAnalysisScope Trap(S); + Deref = S.ActOnUnaryOp(S.getCurScope(), Loc, tok::star, TE); + } + if (Deref.isUsable() && + Deref.get()->isModifiableLvalue(S.Context, &Loc) == + Expr::MLV_Valid && + !E->getType()->isObjCObjectPointerType()) { + S.Diag(Loc, diag::note_typecheck_expression_not_modifiable_lvalue) + << E->getSourceRange() + << FixItHint::CreateInsertion(E->getBeginLoc(), "*"); + } ---------------- Rajveer100 wrote:
Yeah, I was thinking about this earlier, will do it considering the differences. https://github.com/llvm/llvm-project/pull/94159 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits