understand Torsion using Flat Bundles

My question refers to a discussion from this older thread on Neron-Severi group of a Kähler manifold. In the comments below Ted Shifrin's answer there arised a discussion when the map $$H^2(X,\mathbb{Z}) \to H^2(X,\mathbb{C})$$ indced by the canonical inclusion $$\mathbb{Z} \subset \mathbb{C}$$ may be not injective. As Ted pointed out the main reason that prevents this map beeing injective is the presence torsion in $$H^2(X,\mathbb{Z})$$.

Then he continues "From the line bundle side, you can see this with flat bundles (whose curvature forms vanish, and so the De Rham representative is the zero form)."

Unfortunatelly I not understand how his example & argument for line bundles by considering to flat bundles work. Definitely, as the curvature forms of flat bundles vanish, their De Rham representative in $$H^2(X,\mathbb{C})$$ is zero. That's fine.

Why is it an example for torsion elements in $$H^2(X,\mathbb{Z})$$? Does their De Rham representative not already vanish in $$H^2(X,\mathbb{Z})$$ as the curvature is zero? But then it not provide an example for a torsion element.

Or do I miss Ted's point?

Could anybody explain the argument?