Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -15409,7 +15409,10 @@ ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr) { - DiagnoseAssignmentAsCondition(E); + // an assignment always produces an lvalue, and we now check this inside + // PerformImplicitConversion, as conditions will always be implicitly + // converted to an rvalue + // DiagnoseAssignmentAsCondition(E); if (ParenExpr *parenE = dyn_cast(E)) DiagnoseEqualityWithExtraParens(parenE); Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -3860,6 +3860,10 @@ case ICK_Lvalue_To_Rvalue: { assert(From->getObjectKind() != OK_ObjCProperty); + if (SCS.Second == ICK_Boolean_Conversion || + From->getType() == Context.BoolTy) { + DiagnoseAssignmentAsCondition(From->IgnoreImpCasts()); + } ExprResult FromRes = DefaultLvalueConversion(From); assert(!FromRes.isInvalid() && "Can't perform deduced conversion?!"); From = FromRes.get();