Dominic Prummer O.P. :
“The power of the Roman Pontiff is lost. […] (c) By his perpetual insanity or by formal heresy. […] The Authors indeed commonly teach that a pope loses his power through certain and notorious heresy, but whether this case is really possible is rightly doubted.”
(Manuale Iuris Canonci. Freiburg im Briesgau: Herder 1927. 95)