At least in Brazil you can't enforce something the law doesn't allow in a contract - that clause would be considered void without nullifying the contract. And Labour law in Brazil leans (or used to lean) more in favor of the employee,so yes, the law would win. Another aspect there is that unions are more common than in the US, and they will help in such cases.