Commit df5d2822 authored by Igor Kushnir's avatar Igor Kushnir
Browse files

ParamIterator(): '<' in operator< is not an angle bracket

parent 5c14b4ff
......@@ -326,7 +326,10 @@ ParamIterator::ParamIterator(QStringView parens, QStringView source, int offset)
d->m_end = d->m_source.length();
///The whole search should be stopped when: A) The end-sign is found on the top-level B) A closing-brace of parameters was found
int parenBegin = d->m_source.indexOf(parens[0], offset);
int parenBegin = offset - 1;
do {
parenBegin = d->m_source.indexOf(parens[0], parenBegin + 1);
} while (parenBegin != -1 && source[parenBegin] == QLatin1Char{'<'} && isOperator(source, parenBegin));
//Search for an interrupting end-sign that comes before the found paren-begin
int foundEnd = -1;
......
......@@ -140,6 +140,12 @@ void TestStringHelpers::testParamIterator_data()
addTest("Empty", {});
addTest("Foo<T1, T2>", {"T1", "T2"});
addTest("operator<", {});
// These are valid C++ snippets, but I couldn't make such strings be passed to ParamIterator in practice.
addTest("operator< <QString>", {"QString"});
addTest("operator<<<KDevVarLengthArray, Path >", {"KDevVarLengthArray", "Path"});
addTest("operator<=>< QRegularExpression,IndexedString*,char\t>", {"QRegularExpression", "IndexedString*", "char"});
addTest("__not_overloaded2<_Tp, foo<bar>, __void_t<decltype(std::declval<_Tp>().operator<(std::declval<_Up>()))>>",
{"_Tp", "foo<bar>", "__void_t<decltype(std::declval<_Tp>().operator<(std::declval<_Up>()))>"});
addTest("__not_overloaded2<_Tp, foo<bar>, __void_t<decltype(std::declval<_Tp>().operator>(std::declval<_Up>()))>>",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment