Although this question already has an answer, and rightfully so. I believe that anyone who visits this page with the same question should know the ups and downs of wielding over-sized weapons before coming to a conclusion.
Lets start with the Core Rulebook
A creature can't make optimum use of a weapon that isn't properly sized for it... The measure of how much effort it takes to use a weapon is altered by one step for each size category of difference between the wielder's size and the size of the creature for which the weapon was designed. For example, small creature would wield a Medium one-handed weapon as a two-handed weapon. If a weapon's designation would be changed to something other than a light, one-handed, or two-handed by this alteration, the creature can't wield the weapon at all.
A medium creature can use a large one-handed weapon as a two-handed weapon. Because you cannot increase a two-handed weapon, this means that a medium creature cannot wield a large two-handed weapon.
A medium short-sword is a light weapon on a Medium creature, and a one-handed on a small creature. Both creatures would utilize its 1d6 damage in this way, except the small creature takes a -2 penalty because of the size difference (when they could simply wield a longsword for the 1d6). A shortsword becomes a longsword, just as a longsword becomes a greatsword, as you increase size categories. The only difference is that you can take a -2 penalty to wield a smaller version of the weapon made for the next size category higher, at the same damage modifier.
Why would you wield a weapon of a size category not of your own?
1) You are a dual wielder (lets say a bard for example) and in your main hand you hold a longsword, and in your offhand you wield a whip. According to the equipment section, a whip is treated as a one-handed weapon, which means that in order to dual wield (assuming you have the two-weapon fighting feat) you will be taking a -4, -4 penalty. Wielding a "small" whip will treat the weapon as a "light one-handed" at the cost of a -2 penalty. This makes your two-weapon fighting penalties drop to a -2/-2 but increases your whip (offhand attack) by 2 because it is sized differently. Making your end result -2/-4 (essentially you are increasing the chance to hit with your main hand)
2) You have specific feats in weapon specialization and weapon focus, that give you a bonus to damage and hit with a specific type of weapon. Lets say my focus is longswords. Rather than wielding a short sword, it would be more beneficial to me to wield a small longsword because the -2 penalty to size is more than made up for with feats that give +2 to hit and damage when I use a longsword. This is linked in with the first reason.
3) You are playing a class that allows you to bypass the size restriction. For example: The barbarian archetype Titan Mauler. The Titan Mauler does not specifically say that you can wield weapons larger than yourself outside of the archetype description, though it is assumed through her abilities with the minor exception of Jotungrip: A titan mauler may wield a two-handed weapon in one hand though this weapon must be appropriately sized for her. Her level 3 ability allows her to reduce the "over sized" penalty by 1, meaning that for wielding a weapon that is larger than yourself you would take a -1 penalty instead of the -2. You would have to talk to your dm about this first to clarify.
How significant is the attack penalty compared to the damage?
A -2 is a difference of 10% on your hit chance. If you have +1 to hit at level 1, and you are versing someone with 12 ac. All you need to do is roll an 11 or higher to hit. Because there are 20 sides to the dice, each side represents a 5% chance, thus you have a 50% chance of hitting your opponent. If you take a -2 penalty, that would require you to roll a 13 to hit, thus making your chances of hitting a 40%.
Mathematically you can multiply your hit percentage by your average damage output to determine which is most optimal to use. In almost every situation, especially early on, the ability to hit your opponent is far better than the potential damage you could have done. As mentioned above, one of the major reasons to wielding an inappropriately sized weapon is to reduce your penalties to hit.
However there is more to take into consideration. As you level, your class will gain BAB (Base Attack Bonus). This bonus gets applied to your hit chance as well as attack bonuses from Feats, Equipment, Ability Modifiers, and Buffs. Your AC on the other hand, does not scale with your level, it instead only increases through Equipment, Buffs, Feats, and Relevant Ability Modifiers. It is because of this, that as you level you will begin hitting your opponents more and more. Your opponents AC will increase for the exact same reason that your attack bonus will increase -> You will have better equipment, and more feats / buffs at your disposal.
As a rule of thumb, do not invest in AC unless you can keep it roughly 20 + your level, (This does not apply right off the bat) example: Level 10 -> 30ac, Level 14 -> 34ac. Else your opponents will be hitting you so much, that it pays off more to simply have higher HP. This is because the attack bonuses at these levels is so high (from both Players and NPCs) that you will be getting hit anyway.
What exactly are the damage numbers?
On page 145 of the Core Rule Book is the chart for damage for weapons of larger or smaller size categories. This chart covers what is not mentioned in the equipment section -> The equipment tables only show the weapons medium and small damage, thus this chart shows it for Tiny and Large.
Each weapon has a BDR (Base Damage Rating), this number is not shown in the book and it is an average of the weapons potential damage. You simply take the lowest roll, and the highest roll and average the two: 1d6 ~ 1+6 = 7, 7/2 = 3.5. A 6 sided die will give you a BDR of 3.5. A greatsword is 2d6, thus 2+12 = 14, 14/2 = 7 (or simply put 3.5 + 3.5). If we were using a Dwarven Waraxe: 1d10, a large version would be 2d8 -> 5.5 increased to a 9.0. So when we say that you are increasing the damage by roughly 3, we are saying that you are increasing your average damage.
Simple so far? That is only the first step, we covered what the average damage potential was, but now I will talk about consistency. When a barbarian has a choice between a greatsword and a greataxe which one do they pick? When we look at BDR the GS is a 7, the GA is a 6.5. This is because both have the potential of reaching 12, but the GS will never do 1 damage. When you graph out all of the possible rolls on a dice, you notice that the more dice you roll, the more and more the outcomes are consistent and average. Rolling 2d6 has the highest percent chance of totaling a 7 than any other number, the next highest percent roll is either a 6 or an 8. When you roll multiple dice, you create a curve, and you make your numbers more consistent. With a single dice your numbers are much more random.
The third step is considering the damage range. As levels progress your opponents AC will not be the only thing you must overcome. You also have to take into consideration damage reduction. If your opponent has DR 10 silver, and you do not have any silver weapons. You are relying on your melee classes doing more than 10 damage. In this case you may hit your opponent 20 times, but if you cannot roll above a 10 on your damage, then your hit was for nothing. In the example of wielding a Large Greatsword (3d6 = 10.5 BDR) in comparison to a Medium Greatsword (2d6 = 7 BDR) taking a small penalty to hit to increase your BDR from a 7 to a 10.5 is extremely worth it!
Food for Thought: If you are versing an opponent that has DR 9 for example (Though this is rarely a case) you will have a higher percent chance of bypassing his DR with the GA than you will will the GS.
I realize the significance of attack bonus, but when should I sacrifice this?
1) When you are versing an opponent that has High DR
2) When you are versing a caster opponent, and the damage you deal applies to your opponents concentration check
3) When you are versing an opponent you believe to have less AC than the average and higher HP
4) When you have reached the point where your attack bonus is so high, that you will gladly take the extra damage (This typically happens after level 10)
My final words
I realize that this post may spark a lot of attention and negative approval. There was a huge argument about this and I believe that both sides of the argument should be presented. Yes a -2 penalty is significant, yet it is the exact same penalty that a dual wielder takes with both the two-weapon feat and a light offhand weapon. There are far more ways of increasing your attack bonus than there are your damage output. Thank you for taking the time to read this.
Best Answer
If you have those feats, you can definitely use a ranged weapon at least up to 4 size categories larger than you
Which would be Colossal for a Medium creature.
The rules behind this are kind of weird. Basically, it is unclear if projectile weapons requiring two hands to be used are considered two handed weapons or not. Fortunately, this ends up being irrelevant to your question. Either projectile weapons have a handedness corresponding to the number of hands they require to be used, or projectile weapons have no handedness. If projectile weapons have no handedness you can actually use any size of projectile weapon you wish, taking a -2 penalty to hit for every category away from your category the weapon's size is, since the rule prohibiting the use of excessively oversized or undersized weapons applies only to weapons with a handedness (weapons whose handedness is not light, one-handed, or two-handed don't change). If projectile weapons have a handedness, then these feats, which do not specify anywhere that they only apply to melee weapons, certainly apply to ranged weapons as well.
So, in any case, a character that has the listed feats or similar abilities can definitely use ranged weapons as if the feats affected their use, though the feats may not in fact do anything, in which case anyone could use such weapons by default. I've not had a GM choose the later interpretation once the situation was explained (people have thus far invariably favored the former, in my experience), but either is valid by the RAW.
Note that if you are using a firearm the handedness of the weapon doesn't change regardless of size, which used to mean that the rules explicitly allowed you to use a firearm of any size, but this has been FAQ-errataed to disallow the use of oversized weapons "just like non-firearms".
Further explanation:
Here's the most explicit rule that bans weapon use outside of normal handednesses (from the weapons section of the CRB but also found in the 'normal' section of e.g. Titan Technique):
So 'how much effort it takes to use a weapon' is defined to be its handedness and handedness is explicitly limited to three valid options: light, one handed, or two handed. When we upsize or downsize a weapon, we change its handedness one step and if our end result would be something other than light, one-handed, or two-handed than the weapon can't be used. Of the feats listed, Golaith Grip, Titan Technique, Lighten Weapon, and Titan Slayer all reduce the handedness modification for certain oversized weapons so that you could choose a suitable oversized weapon so that its handedness would be the handedness of a similar weapon of the appropriate size. If ranged weapons have a handedness (which must be light, one-handed, or two-handed, remember) then the feats would result in the handedness for an oversized weapon being an element of the set (light, one-handed, two-handed), so in this case ranged weapons benefit from the feats.
The fiasco with the handedness of firearms seems to lend credence to this interpretation as the designers, in their FAQ errata of the terrible, terrible firearm handedness rule stated:
Rather than 'just like with melee weapons'.
It could instead be argued that, while they may require one or two hands to be used to wield them, projectile weapons don't have a handedness, for example the CRB says:
Since these designations, in this viewpoint, only apply to melee weapons, ranged weapons have no handedness at all! When a game entity lacks a property and a rule tells you to modify that property, you ignore that modification. For example, if you cast Bear's Endurance on a Zombie the spell works just fine (i.e. the Zombie can be a valid target and the spell will come into effect normally) but the Zombie's Constitution score does not change.
If this is the case, then the handedness of projectile weapons can't change when you increase their size. You can certainly still get projectile weapons in different sizes-- the rules explicitly call out that every weapon has a size-- and you still take an accuracy penalty from that other rule:
but since the handedness doesn't "[change] to something other than light, one-handed, or two-handed by this alteration" you aren't barred from using it regardless of the size. This, obviously, would also render your feats useless with regard to projectile weapons (since there's no handedness to reduce, either).
Despite the weirdness of this perspective, the rules do tend to go out of their way to call out the handedness of ranged weapons when relevant to Two-Weapon fighting in a manner that would seem to lend credence to this interpretation:
The "Treat x as y" language seems to strongly imply, but doesn't necessarily mean, that these thrown weapons at least don't have a handedness. Certainly the bola in particular never gives itself a handedness-compatible requirement in its description, despite the general rule that ranged weapons ought to do so. This would seem to indicate that at least some ranged weapons have no handedness, but the results of accepting that implication are extremely problematic (an Atomie, for example, could dual-wield Colossal Repeating Heavy Crossbows for example). Similar wording is used when describing how crossbows interact with Two-Weapon Fighting.
It's probably worth noting that the 'treat x as if it were a y' language doesn't always mean that x is not a y in practice as well as theory; for an example, the Forge domain variant channeling reads in part:
While we all know that constructs, metal or otherwise, are creatures anyways.
Regardless of which of the two RAW-valid positions your group plays by (it's the first one. No one uses the second one. It only comes up when people start trying to argue why these feats and similar things don't work and put their feet in their mouths, but in that context it comes up quite a lot), a character that has any of these feats can wield a projectile weapon at least as large as if that projectile weapon were a two-handed melee weapon.
Extra notes from experience: