In some jurisdictions, certain types of contracts have terms which are set by statute. For instance, employment contracts might include a certain minimum number of vacation days, or lease agreements might limit overdue rent penalties to some percentage. The statute will specifically say that contract terms which would waive these requirements are void.
Now, suppose that, say, Landlord and Tenant enter into an agreement which violates the statute, with the overdue rent penalty set arguably too high. Rent is late, Landlord demands the listed penalty, Tenant argues that the contract term is void. There's some question over interpretation, though, and in lieu of a lawsuit Landlord and Tenant settle out of court, with Tenant agreeing to forego any claim in exchange for some partial remedy.
Is the out-of-court settlement itself enforceable? After all, its terms had the same basic effect as those in the original contract, allowing a penalty above that allowed by law. If Tenant had second thoughts later, could they successfully argue that the settlement itself should be rescinded? Is it possible to effectively settle a lawsuit over terms which might be statutorily limited?
I suspect that the answer here is widely applicable, but let's take English law.