The SL(2, Z) anomaly recently derived for type IIB supergravity in 10 dimen
sions is shown to be a consequence of T-duality with the type IIA string, a
fter compactification to 2 dimensions on an 8-fold. This explains the ident
ity of the gravitational 8-forms appearing in different contexts in the eff
ective actions of type IIA and IIB string theories. In this framework, cons
traints on the compactification manifold arise from modular invariance of t
he 2d theory. Related issues in 6 dimensions are examined, and it is argued
that similar anomalies are present on the worldvolumes of M-theory 5-brane
s and orientifold 5-planes.