The paper proposes a heat-flux based topology optimization approach to design self-supported enclosed voids for additive manufacturing. The enclosed overhangs that require supports in additive manufacturing are removed from the optimized design by constraining the maximum temperature of a pseudo heat conduction problem. In the pseudo problem, heat flux is applied on the non-self-supported open and enclosed surfaces. Since the density-based topology optimization involves no explicit boundary representation, we impose such surface slope dependent heat flux through a domain integral of a Heaviside projected density gradient. In addition, the solid materials and the void materials in the pseudo problem are assumed to be thermally insulating and conductive, respectively. As such, heat flux on the open surfaces can be successfully conducted to external heat sink through the void (or conductive) materials. However, heat flux on the non-self-supported enclosed surfaces is isolated by the solid (or insulating) materials and thus leads to locally high temperature. Hence, by limiting the maximum temperature of the pseudo problem, self-supported enclosed voids can be achieved, and the slope of the open surfaces would not be affected. Numerical examples are presented to demonstrate the validity and effectiveness of the proposed approach in the design of self-supported enclosed voids.