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 arose a discussion when the map $H^2(X,\mathbb{Z}) \to H^2(X,\mathbb{C})$ induced by the canonical inclusion $\mathbb{Z} \subset \mathbb{C}$ may be not injective. As Ted pointed out the main reason that prevents this map being 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)."

Unfortunately 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 does it provide 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.

Does anybody understand what Ted had by the quoted remark in mind? I tried to ask but probably that was quite obvious point and I'm just too fool to see it.