  The SL(2,Z) duality transformations of type IIB supergravity are shown to be
anomalous in generic F-theory backgrounds due to the anomalous transformation
of the phase of the chiral fermion determinant. The anomaly is partially
cancelled provided the ten-dimensional type IIB theory lagrangian contains a
term that is a ten-form made out of the composite U(1) field strength and four
powers of the curvature. A residual anomaly remains uncancelled, and this
implies a certain topological restriction on consistent backgrounds of the
euclidean theory. A similar, but slightly stronger, restriction is also derived
from an explicit F-theory compactification on K3 x M8 (where M8 is an
eight-manifold with a nowhere vanishing chiral spinor) where the cancellation
of tadpoles for Ramond--Ramond fields is only possible if M8 has an Euler
character that is a positive multiple of 24. The interpretation of this
restriction in the dual heterotic theory on T2 x M8 is also given.
