Pope Pius XI's condemnation of onanism (contraception) in his 1930 encyclical Casti Connubii
(spec. §59: "…so long as the intrinsic nature of the [marriage] act is preserved.") is a case study of Fr. Cartechini, S.J's 1951 De Valore Notarum Theologicarum p. 20
regarding ex cathedra
pronouncements of morals:
De qualificatione theologica sententiæ condemnatoriæ abusus matrimonii in encyclica "Casti Connubii": utrum sit solemnis definitio ex cathedra quod onanismus sit semper peccatum mortale. Quidam affirmabant esse dogma quia Pontifex adhibet verba satis solemnia. Certe ad solemnem definitionem requiruntur hæc elementa: quod loquatur ut supremus pastor et doctor, et quod velit adhibere supremam suam auctoritatem in pleno gradu. Quod hic loquatur ut supremus pastor et doctor patet; inquirendum restat utrum voluerit uti sua suprema auctoritate, ferendo sententiam definitivam. Sed, admisso quod non sit dogma fidei, tamen doctrina ab ea promulgata certe est infallibiliter vera ex hoc capite: quod Papa verbis solemnibus authentice significet doctrinam ex antiquis temporibus ab ordinario et universali magisterio constanter propositam ut tenendam et observandam.
Regarding the theological qualification of the condemnations against the abuses of matrimony in the encyclical Casti Connubii: whether contraception is always a mortal sin is a solemn ex cathedra definition. Some affirm it to be dogma because the Pontiff uses very solemn words. For a solemn definition, these elements are required: that he speak as supreme pastor and teacher, and that he wants to use his supreme authority in its full degree. It is clear that he speaks as supreme teacher and pastor in this encyclical; it remains to inquire whether he wanted to use his supreme authority, giving a definitive pronouncement. But, even if it is not a dogma of the faith, the doctrine he promulgated certainly is infallibly true because the Pope authoritatively and with solemn words expresses a moral doctrine that from ancient times the ordinary and universal magisterium has constantly proposed must be be held and observed.
[my translation with comparison to p. 18 of the Italian]