ClangBackEnd: Fix mis-detection of operator<

Inside the body of a function template, clang reports a different cursor
type for operators in some cases. Make sure we don't mistake such
operator< or operator> as opening or closing a template, respectively.

Fixes: QTCREATORBUG-25596
Change-Id: Ifc357e199ea13e44ac501613639e667c333d48e3
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-04-16 15:38:52 +02:00
parent ee3e4f9e25
commit f307c55eac
3 changed files with 24 additions and 0 deletions

View File

@@ -771,3 +771,20 @@ void func(T v) {
}
static std::vector<std::pair<int, int>> pv;
template <class T, long S>
struct vecn
{
T v[S];
};
template <class T, long S>
static inline constexpr vecn<T, S> operator<(vecn<T, S> a, vecn<T, S> b)
{
vecn<T, S> x = vecn<T, S>{};
for(long i = 0; i < S; ++i)
{
x[i] = a[i] < b[i];
}
return x;
}