Short answer. No, not in those situations. Article 956 of the Civil Code provides that an ineffective legacy merges into the mass of the estate, except in cases of substitution and of the right of accretion — so if the will named a substitute, or accretion applies, the legacy goes to the substitute or co-legatees instead of the general estate.
What the law says
If the legatee or devisee cannot or is unwilling to accept the legacy or devise, or if the legacy or devise for any reason should become ineffective, it shall be merged into the mass of the estate, except in cases of substitution and of the right of accretion.
Civil Code, Article 956 — If the Legatee Cannot or Will Not Accept. Read the full provision →
The default rule: merger into the estate
Article 956 states that if the legatee or devisee cannot or is unwilling to accept the legacy or devise, or if the legacy or devise for any reason should become ineffective, it shall be merged into the mass of the estate. As a default, a failed legacy simply falls back into the general estate to be distributed along with everything else, rather than passing to any particular person by default.
The two named exceptions
The article then carves out two exceptions to that default: except in cases of substitution and of the right of accretion. Where the will itself names a substitute to take the legacy if the original legatee cannot or will not accept it, the substitute takes it instead of the estate. Where accretion applies — typically because the legacy was left jointly to several legatees — the share that failed accrues to the remaining co-legatees rather than falling back into the general estate.
Why substitution and accretion take priority
Both exceptions reflect situations where the testator's own will already provides for exactly this contingency, either by naming an alternate recipient directly, or by leaving the legacy in a way that lets the other beneficiaries absorb a failed share. Falling back to the general estate is the residual outcome for when the will offers no such built-in answer — it is not meant to override an answer the will has already supplied.
What this article does not resolve
Article 956 identifies merger, substitution, and accretion as the possible outcomes but does not itself set out the specific requirements for a valid substitution or for the right of accretion to apply in a given will — those depend on other provisions and on how the will is actually worded. Whether your situation genuinely falls under one of the two exceptions depends on what the will itself provides.