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.
This doesn't really work as far as I can tell, RAW or RAI. While it is the case that in theory a Melee Attack with a Heavy Ranged Weapon would satisfy both criteria, there is no weapon that can normally perform such an attack, as far as I'm aware. Using a Heavy Crossbow or a Longbow to make a Melee Attack would be attacking with an Improvised Melee Weapon, which is both not a Ranged Weapon and does not have the Heavy property, so neither Feat would be useful.
If we are being generous we could say that attacking with a Heavy Crossbow would be like a Club and a Longbow would be like a Staff, and per the Improvised Weapons rules we could use those weapon stats for our Improvised Weapon, however, note that neither of these have the Heavy property, so you would be unable to use either Feat in this case as well. (The Heavy property, particularly on Ranged Weapons, seems to be not about the weight of the weapon (an intrinsic property of the thing), but about the strength required to attack with such a weapon in it's intended manner. In this way it would make sense that neither Feat would work.)
As far as I can see, the rule for using a ranged weapon for melee is just: "If a character uses a ranged weapon to make a melee attack, or throws a melee weapon that does not have the thrown property, it also deals 1d4 damage." That says nothing about changing the traits of the weapon, nor that the weapon is treated as an improvised weapon for the purposes of the attack- the rules for improvised weapons are a seperate clause within the same paragraph. As such, I'd argue that hitting someone with the butt of your heavy crossbow is effectively an attack with a martial weapon, damage 1d4 bludgeoning, with the traits Ammunition (range 100/400), heavy, loading and two-handed- of which ammunition doesn't apply because it's not a ranged attack, and thus loading doesn't constrain multiattack (because only being able to load 1 piece of ammo per round doesn't affect the bonks per round). Per the thrown weapon rules, I'd also argue that bonking people with a crossbow would rely on the attacker's dex, because it doesn't have the finesse property and as a ranged weapon it's dex based.
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.)
Good catch on the Ammunition property, I did miss that- I'm not sure if that goes for weapon traits or just proficiencies, or if it's just a reference to that particular part of the improvised weapons section which specifically calls out ranged weapons in melee.
I do want to be very nitpicky with it- that's what I'm doing here, having fun seeing what the rules technically allow rather than what they actually play like at the table XD
I kind of love the idea that the dart not having the ammunition property means it doesn't count as an improvised weapon when used in melee, because that would mean a dart is just a dagger that weighs a quarter as much and doesn't have the light property (also am I wrong to think that the dagger's thrown property does nothing, since a thrown melee weapon without the thrown property does 1d4 damage with a range of 20/60ft anyway?)
I think if one is being nitpicky, the reading of the Ammunition Property is that it specifically calls out weapons with ammunition as being treated as Improvised Weapons (which would come with not being able to use the weapon's properties or proficiency, or at least so it seems to me), rather than redirecting you to read a different part of the rules section. It would be odd (and honestly it is a bit odd with the normal reading as well) to have two distinct properties that qualifies something to fall under the same rule (being a Ranged Weapon and having the Ammunition Property), particularly when one is always going to contain the other.
And the Thrown property on the Dart being useless only really becomes a problem if you take this very specific and nitpicky ruling to be good, which honestly mostly serves as evidence that reading the rules that way is not RAI. It seems to be the RAI intention that the Dart having the Thrown Property is to allow you to use your proficiency for the attack, which you would not be able to if you threw an Improvised Weapon (such as if you were to throw a Sickle).
That's on me, I've been playing my tavern brawler for too long and overlooked that most people don't have imrpovised weapon proficiency. It looks like using most ranged weapons in melee is maybe improvised for two reasons? Like, the ammunition property makes it improvised, but also the "ranged weapon to make a melee attack" rule makes it improvised. Which I guess lines up if you take it as Javelins being good for melee and throwing, while darts are only really good for throwing- makes sense to me, although it's weird to have the same thing said twice over (a ranged weapon is improvised, but also an ammunition traited weapon is improvised, and only ranged weapons have that trait so they're already improvised in melee)