Pope Pius XI
Quadragesimo Anno §123
Quadragesimo Anno: On Reconstruction of the Social Order
123 Accordingly, Venerable Brethren, you can well understand with what great sorrow We observe that not a few of Our sons, in certain regions especially, although We cannot be convinced that they have given up the true faith and right will, have deserted the camp of the Church and gone over to the ranks of Socialism, some to glory openly in the name of socialist and to profess socialist doctrines, others through thoughtlessness or even, almost against their wills to join associations which are socialist by profession or in fact.
Source: Quadragesimo Anno (Vatican.va)