Fixes https://github.com/llvm/llvm-project/issues/44601.
This patch handles a bug when parsing a below example code :
template <class> class S;
template <class T> bool operator<(S<T> const &x, S<T> const &y) {
return x.i < y.i;
}
template <class T> class S {
int i = 42;
friend bool operator< <>(S const &, S const &);
};
int main() { return S<int>{} < S<int>{}; }which parse < <> as << >, not < <> in terms of tokens as discussed in discord.
- Add a condition in tryMergeLessLess() considering operator keyword and >
- Force to leave a whitespace between tok::less and a template opener
- Add unit test
isn't this going to crash if Tokens.size() is 3?