I do not know if it is a heresy, but here are excerpts from a speech of Pope Pius XII that scandalized me because I believe that the Universe is only a few thousand years old and I thought that was what the Church teaches according to scripture, but Pope Pius XII didn't believe that. He does not say in this speech specifically if he believed in the theory of evolution or not, but I think it is likely that he did.
Pope Pius XII (Address to the Pontifical Academy of Sciences, November 22, 1951):
31. "If the scientist turns his attention from the present state of the universe to the future, even the very remote future, he finds himself constrained to recognize, both in the macrocosm and in the microcosm, that the world is growing old.
In the course of billions of years, even the apparently inexhaustible quantities of atomic nuclei lost utilizable energy and, so to speak, matter becomes like an extinct and scoriform volcano. And the thought comes spontaneously that if this present cosmos, today so pulsating with rhythm and life is, as we have seen, insufficient to explain itself, with still less reason, will any such explanation be forthcoming from the cosmos over which, in its own way, the shadow of death will have passed."
Here we see that Pope Piux XII believed the Universe was "billions" of years old.
Pope Pius XII:
36. The examination of various spiral nebulae, especially as carried out by Edwin W. Hubble at the Mount Wilson Observatory, has led to the significant conclusion, presented with all due reservations, that these distant systems of galaxies tend to move away from one another with such velocity that,
in the space of 1,300 million years, the distance between such spiral nebulae is doubled. If we look back into the past at the time required for this process of the "expanding universe," it follows that, from one to
ten billion years ago, the matter of the spiral nebulae was compressed into a relatively restricted space, at the time the cosmic processes had their beginning.
Here we see again that he believes the Universe was "billions" of years old.
Pope Pius XII:
37. To calculate the age of original radioactive substances, very approximate data are taken from the transformation of the isotope of uranium 238 into an isotope of lead (RaG), or of an isotope of uranium 235 into actinium D (AcD), and of the isotope of thorium 232 into thorium D (ThD). The mass of helium thereby formed can serve as a means of control. This leads to the conclusion that the average age of the oldest minerals is at the most
five billion years.
Again, "billions" of years old.
Pope Pius XII:
39. The oscillations of gravitation between these systems, as also the attrition resulting from tides, again limit their stability within a period of from
five to ten billion years.
Again, "billions" of years.
Pope Pius XII:
44. It is undeniable that when a mind enlightened and enriched with modern scientific knowledge weighs this problem calmly, it feels drawn to break through the circle of completely independent or autochthonous matter, whether uncreated or self-created, and to ascend to a creating Spirit. With the same clear and critical look with which it examines and passes judgment on facts, it perceives and recognizes the work of creative omnipotence, whose power,
set in motion by the mighty "Fiat" pronounced billions of years ago by the Creating Spirit, spread out over the universe, calling into existence with a gesture of generous love matter busting with energy. In fact, it would seem that present-day science, with one sweeping step back across millions of centuries, has succeeded in bearing witness to that primordial "Fiat lux" uttered at the moment when, along with matter, there burst forth from nothing a sea of light and radiation, while the particles of chemical elements split and formed into millions of galaxies.
Again, not a few thousand years ago, but the "Fiat" of God was "billions" of years ago.
Pope Pius X:
50. It has, besides, followed the course and the direction of cosmic developments, and, just as it was able to get a glimpse of the term toward which these developments were inexorably leading, so also has it pointed to
their beginning in time some five billion years ago. Thus, with that concreteness which is characteristic of physical proofs, it has confirmed the contingency of the universe and also the well-founded deduction as to the epoch when the cosmos came forth from the hands of the Creator.
Again, "billions" of years ago.
In another speech, Pope Pius XII allowed the studying of evolution among Catholics and because of this Pope John Paul II declared that Pope Pius XII said that evolution was compatable with Catholicism. You can see that on wikipedia,
hereSo while I am not sure if it is heresy or not, I disagree with it and think it is wrong and could see why some might think it is heretical.