Every legacy, gift or bequest, of money or personal property, or of any interest, benefit or use therein, either direct, implied or otherwise, contained in any last will and testament or codocil, in favor of any religious or ecclesiastical corporation, sole or aggregate, or any religious or ecclesiastical society, or to any religious denomination or association, either for its own use or benefit, or for the purpose of being given or appropriated to charitable uses, shall be null and void, and the distributees shall take the same as though no such testamentary disposition had been made.