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.
If you look at the Ammunition Property it says “If you use a weapon that has the ammunition property to make a melee attack, you treat the weapon as an improvised weapon”, which I read as meaning your weapon is an Improvised Weapon rather than a Ranged Weapon. Although I do concede that the improvised weapons rule says that if you are using a Ranged Weapon to make a Melee Attack it will deal 1d4 damage, which I assume means that you can’t use the rule that says that you can treat it like another similar weapon, which I think is odd, but ok.
(Also, if you want to be very nitpicky about it, the ammunition property says you can’t make ranged attacks without loaded ammunition, but any type of attack will spend your ammunition. However, I don’t think that’s a fair reading, and I think the ammunition property simply does not apply, because you are using it as an Improvised Weapon and therefore none of the Properties apply.)
I suppose if you really wanted to get into the details, the rules in the Ammunition section would not apply to weapons that are Ranged Weapons, but do not have the Ammunition Property, like the Dart or Net. But I feel like it would be most reasonable to rule that these are also considered Improvised Weapons and not Ranged Weapons that deal 1d4 damage if used to make a Melee Attack. (Although the Net can not deal damage as per it’s Special Property, so that doesn’t really apply to it, so you would be left with the Dart, which doesn’t have the Heavy Property, and thus isn’t really relevant to the greater discussion here.)