Yes, certainly in 5e.
Invisibility reads:
The spell ends for a target that attacks or casts a spell.
Spiritual Weapon Reads:
When you cast the spell, you can make a melee spell attack against a creature within 5 feet of the weapon...
As a bonus action on your turn, you can move the weapon up to 20 feet and repeat the attack against a creature within 5 feet of it.
So per the spell (spiritual weapon) the caster is attacking with it (as opposed to the weapon itself attacking or even the caster ordering it to attack) - that would seem to clearly break invisibility.