  Quantum anomalies, breakdown of classical symmetries by quantum effects,
provide a sharp definition of symmetry protected topological phases. In
particular, they can diagnose interaction effects on the non-interacting
classification of fermionic symmetry protected topological phases. In this
paper, we identify quantum anomalies in two kinds of (3+1)-dimensional
fermionic symmetry protected topological phases: (i) topological insulators
protected by CP (charge conjugation $\times$ reflection) and electromagnetic
$\mathrm{U}(1)$ symmetries, and (ii) topological superconductors protected by
reflection symmetry. For the first example, which is related to, by
CPT-theorem, time-reversal symmetric topological insulators, we show that the
CP-projected partition function of the surface theory is not invariant under
large $\mathrm{U}(1)$ gauge transformations, but picks up an anomalous sign,
signaling a $\mathbb{Z}_2$ topological classification. Similarly, for the
second example, which is related to, by CPT-theorem, time-reversal symmetric
topological superconductors, we discuss the invariance/non-invariance of the
partition function of the surface theory, defined on the three-torus and its
descendants generated by the orientifold projection, under large
diffeomorphisms (3d modular transformations). The connection to the collapse of
the non-interacting classification by an integer ($\mathbb{Z}$) to
$\mathbb{Z}_{16}$, in the presence of interactions, is discussed.
