Currently when clang fails to deduce auto return type of a function,
it does not emit any notes about why it fails. This causes difficulty
for users to fix such errors.
Actually, clang already generates the information for emitting notes
about the failed deduction. There is a TODO for actually emitting
them.
This patch tries to implement the TODO. Basically it passes the
failed template specialization candidate set from the point of
specialization failure back to the point where the deduction starts.
It is not comprehensive but would be a start for further improvement.
Do we need to allow the location to be set after the set is created? Giving this type an additional state where the location is absent seems error prone, and in the uses below it looks easy to set the location in the caller instead of the callee.