Short answer. The children can demand their legitime. A testator cannot deprive compulsory heirs, including legitimate children, of their legitime except in cases the law expressly allows, so a will leaving everything to charity and nothing to the children is not enforceable to that extent — the children's legitime must still be respected.
What the law says
The testator cannot deprive his compulsory heirs of their legitime, except in cases expressly specified by law.
Civil Code, Article 904 — The Legitime Cannot Be Taken Away. Read the full provision →
Legitime is protected regardless of what the will says
The statute is categorical: a testator cannot deprive compulsory heirs of their legitime. Children are compulsory heirs, and the legitime the law reserves for them exists independently of what a testator chooses to write in a will. A will that purports to give everything to charity and nothing to the children does not succeed in cutting the children out of that reserved portion — the legitime stands regardless of the testator's contrary wish.
The narrow exception: cases the law itself specifies
The only way a compulsory heir can actually lose the legitime is through a situation the law expressly specifies — such as valid disinheritance for a legally recognized cause, carried out in the manner the law requires. Simply preferring to leave everything to charity is not itself one of those recognized grounds; absent a specific legal basis for excluding a child, the legitime remains protected.
The will is not entirely void, but it cannot defeat the legitime
This does not necessarily mean the whole will collapses. The testator retained the freedom to dispose of the free portion of the estate — whatever remains after the legitime of the compulsory heirs is set aside — and could validly give that free portion to charity. What the will cannot do is treat the entire estate as though the children's legitime did not exist; the children remain entitled to demand that share, reducing whatever charitable gift exceeds the free portion.
No conditions or burdens can be attached to the legitime either
The same article adds a second protection: the testator cannot impose any burden, encumbrance, condition, or substitution of any kind whatsoever on the legitime. This means even if the will had left the children something but tied it to conditions, that portion corresponding to their legitime would still have to be given to them free of such strings, on top of the outright prohibition against disinheriting them of it entirely.
What the children would need to do
Because the legitime is protected as a matter of law rather than something the will can simply erase, children in this position are not left without recourse — but they generally need to actively assert their claim to have the charitable gift reduced to the extent it impairs their legitime, rather than assuming the excess portion reverts to them automatically without any action on their part. Figuring out exactly how much of the estate the legitime represents, and how much the charitable gift must be trimmed back, depends on valuing the whole estate and applying the specific legitime rules that govern legitimate children.