For instance:
template
void fun(const Type1 &v1, const Type2 &v2)
{
largest::type val
There is no simple answer. If the largest type on your machine is a long and the two types passed are an unsigned long and a signed long, what type would you expect val to be? If unsigned you run the risk of a negative number which will not fit in it. If signed, you may overflow but still have a number that would fit in the unsigned number space.
If these limitations are acceptable you could use Alexey Malistov's approach, but the resulting type if Type1 and Type2 are the same size but different types will be different depending on the order the values are passed.
Take a look at the boost mpl function if_, with which you can pick one of two types. You'll need need to come up with your own rules for how to pick the resulting type.