Edit: A lot of people say, that GWM needs a melee weapon attack, but they miss Jesses point: While GWM requires a melee attack with a heavy weapon, Sharpshooters only criteria is an attack with a ranged weapon (not a ranged weapon attack).
Jesse bases his claim on the fact, that a crossbow is still a ranged weapon, even if used as an improvised weapon for melee combat. That’s why it deals 1d4(!)+20 damage.
(It works with any ranged, heavy weapon btw., so Longbow qualifies too.)
Of course Jesse is playing the devils advocate here and of course, no somewhat sane Walter will allow this in any campaign ever, as it’s obviously not the intention behind these feats. But you could read it that way and that’s Jesses (paperthin) point.
Besides: he finds the image of a barbarian running around recklessly smashing a crossbow over everyone’s head to just be hilarious.
Is smacking someone over the head with a Glock not an attack with a gun?
Is a bow no longer a ragend weapon just because I don’t use it as one?
Yes, it is an attack with a gun. That gun just isn't a ranged weapon for the purposes of that attack.
Yes, using a bow as a melee weapon, in 5e, absolutely ceases to become a ranged weapon while you do so.