No, this is not always safe.
I suppose your math functions do more than that, but here is an example where the result will be different.
template <class T, class U> std::common_type_t<T, U> add(T t, U u) { return t + u; }
If you call this function with two char , the result will be char . You would automatically infer the return type, this would give an int .
source share