I think for a person of average genetics, if you want to gain or lose weight, more focus must be put on diet.
However, if you are just trying to stay at the same bodyweight with low body fat and get as strong as possible (which is what gymnasts want), diet does not play that big a role as long as you are eating enough to have energy to train and are not losing or gaining weight.
Of course if you want to max out your potential/reach your genetic limit, you will have to control both diet and training with great discipline over a period of 10+ years.
As to the original poster's question, I think it depends on how fast you gained the muscle. If you are already past puberty and you gained something like 10kg in 1 year, it is likely that the hypertrophy is mostly sacroplasmic and not myofibrillar and hence you wouldn't gain as much strength as you would if you did it over a period of 5 years.
When you first start off, of course you can gain strength + hypertrophy regardless of how old you are, but once you reach the intermediate stage that is where things get more complicated. Just as Joshua mentioned how there is a strength level you reach where you will have to get bigger if you want to get any noticeably stronger, there is also a strength ceiling where regardless of how heavy you get, you can't get any stronger. That's why not all the weightlifters in the 105+kg category are like 180kg.
Food for thought. o.O
Edit:
Sorry, I thought about what I typed regarding staying at the same weight. I think that this only applies if you are very close to your own 'base' bodyweight (which is a weight you would be if you only ate 3 normal meals a day and trained something like 1-2 times a week).
If for example, you worked your ass off to gain like 10-20kg 'functional' muscle over a period of 5 years to reach an 'optimum' bw for the sport you are competing, the above about how diet does not matter as much will cease to apply. For example, the optimum weight for weightlifters (to maximise the weight they can lift in the snatch and clean+jerk) who are 175cm tall is something like 94kg, diet becomes very important if you want to retain your strength and hypertrophy, especially if you aren't naturally that big to begin with.