This is to help improve error reporting with SFINAE as part of the bug report here:

http://llvm.org/bugs/show_bug.cgi?id=13309

So now when this program compiles:

template<class T> auto h(T x)->decltype(x.smurf()){return x.smurf();} void h() {} template<class T> auto g(T x)->decltype(h(x)){return h(x);} template<class T> auto f(T x)->decltype(g(x)){return g(x);} int main(){ f(3); }

Clang will report back this error with the true diagnostics:

smurf.cpp:5:3: error: no matching function for call to 'f' f(3); ^ smurf.cpp:1:42: note: candidate template ignored: substitution failure [with T = int]: member reference base type 'int' is not a structure or union template<class T> auto h(T x)->decltype(x.smurf()){return x.smurf();} ^

Now this only does this when there is single overloads involved. If we change

the example to add an extra overload for `h`, like this:

template<class T> auto h(T x)->decltype(x.smurf()){return x.smurf();} void h() {} template<class T> auto g(T x)->decltype(h(x)){return h(x);} template<class T> auto f(T x)->decltype(g(x)){return g(x);} int main(){ f(3); }

Then we get an error like this instead:

smurf.cpp:6:3: error: no matching function for call to 'f' f(3); ^ smurf.cpp:3:41: note: candidate template ignored: substitution failure [with T = int]: no matching function for call to 'h' template<class T> auto g(T x)->decltype(h(x)){return h(x);} ^

So clang basically stops when there is multiple overloads. If the user needs

to see more detail for this, we could look at adding an option for a full

backtrace in the future.

Either way, I think this is very useful to have, and improves the error

reporting in clang immensely. I would like to get this patch merged into

clang.