Is there any guarantee on the order of substitution in a function template after type deduction?
Consider this function template: template<typename T> typename soft_error<T>::type foo(T, typename hard_error<T>::type) { } After deducing type T from the type of the first argument in the call to foo() , the compiler will proceed to substitute T and instantiate the function signature. If substitution for the return type gets executed first, causing a simple substitution failure, the compiler will discard this function template when computing the overload set and search for other viable overloads (SFINAE). On the other hand, if substitution for the second function parameter occurs first,