Yup. But how can a POPE be a heretic?
Read Pope Paul IV’s Apostolic Constitution “Cum Ex Apostolic Officio” issued on February 15, 1559. It deals with the validity of a prelate or Pope in the event they are in heresy or apostasy. Since it is regarding faith and morals and was issued ex cathedra (from the Chair of Peter), it is therefore considered not only infallible, but to be held in perpetuity.