Freemasons cannot be Popes.
That's debatable. Can they be validly elected popes, since they are excommunicated for Fɾҽҽmαsσɳɾყ? Yes. Pope Pius XII changed the rules of the conclave (as did Pius X) and ordered that even those who are excommunicated shall not be prohibited from voting or being voted for, in the conclave.
I tend to believe that both Pius X and Pius XII saw the growing disorder and heresy in the Cardinals and despaired that there would even be any orthodox Cardinals who could be elected, as time went on. So, to preserve the papacy, since it is a
sign of unity of the faith and the
visible sign of the visible church, they changed the rules, so that even a heretic/excommunicant could be elected, for a vacant seat is worse than a heretic sitting in it. This is how important the SIGN and MEANING of the papacy is.
34. No Cardinal, by pretext or reason of any excommunication, suspension, in-terdict or other ecclesiastical impediment whatsoever can be excluded in any way from the active and passive election of the Supreme Pontiff. Moreover, we suspend such censures for the effect only of this election, even though they shall remain otherwise in force.” (Cons. “Vacantis Apostolicae Sedis,” 8 December 1945)
Fr Cekada attacks the above on his website (of course he does, because he's obsessed with the papal question). He says there is usually an interpretation of canon law, though for this one law, he said no interpretation exists. So, instead of the obvious answer being that NO INTERPRETATION IS REQUIRED (duh?), he goes on to define every major word in the above law, reformulate it's meaning to his own understanding and then say that the above "doesn't mean what it says." Very modernist of him.
I'm not comparing Fr C to Bill Clinton by any means, but it reminds me of the Monica-Bill scandal when Bill was asked a question and responded: "It depends what the meaning of "is" is." ...Only those who don't want to see the truth, or want to hide it, resort to "high brow", intellectual re-interpretation of the english language. Anyone who reads the above passage cannot help but see that it says plainly that excommunicated persons can elect and be elected. It's very simple; it needs no interpretation.
---
Can an excommunicant exercise their spiritual office, after elected?
I'd lean towards 'no', but that's just my opinion. The sedeprivationist theory would say their spiritual office cannot be exercised because of their excommunication, but their material office is still valid and in force, for no one can take away the pope's right to be the pope, except God through death, or personal abdication.