It's going to be true if the user tank's y is the same or greater than the enemy's y since you loop upwards from the enemy's y.
Presuming your positions are integers, the test would just be:
if (y == userTankPos->y)
without the loop, with which, by the way, you are using the desktop's width as a boundary (you probably meant height)
bool Enemy::lineOfSight_HOR()
{
int x = e_enemySprite.getPosition().x;
int y = e_enemySprite.getPosition().y;
if (y == userTankPos->y)
{
return true;
}
return false;
}