  We consider closed manifolds that admit a metric locally isometric to a
product of symmetric planes. For such manifolds, we prove that the Euler
characteristic is an obstruction to the existence of flat structures,
confirming an old conjecture proved by Milnor in dimension 2. In particular,
the Chern conjecture follows in these cases. The proof goes via a new sharp
Milnor--Wood inequality for Riemannian manifolds that are locally a product of
hyperbolic planes. Furthermore, we analyze the possible flat vector bundles
over such manifolds. Over closed Hilbert--Blumenthal modular varieties, we show
that there are finitely many flat structures with nonzero Euler number and none
of them corresponds to the tangent bundle. Some of the main results were
announced in C.R. Acad. Sci. Paris, Ser. I 346 (2008) 661-666.
