forked from qt-creator/qt-creator
CppEditor: Fix crash
Fixes: QTCREATORBUG-26441 Change-Id: Ib5a99d474eac8677a65eb8a4a9b4fbe259c61ad3 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -417,17 +417,18 @@ bool maybeAppendArgumentOrParameterList(QString *expression, const QTextCursor &
|
||||
|
||||
bool isCursorOnTrailingReturnType(const QList<AST *> &astPath)
|
||||
{
|
||||
for (auto it = astPath.cend() - 1, begin = astPath.cbegin(); it >= begin; --it) {
|
||||
if (astPath.size() < 3)
|
||||
return false;
|
||||
for (auto it = astPath.cend() - 3, begin = astPath.cbegin(); it >= begin; --it) {
|
||||
if (!(*it)->asTrailingReturnType())
|
||||
continue;
|
||||
const auto nextIt = it + 1;
|
||||
const auto nextNextIt = nextIt + 1;
|
||||
if (nextNextIt != astPath.cend() && (*it)->asTrailingReturnType()) {
|
||||
return (*nextIt)->asNamedTypeSpecifier()
|
||||
&& ((*nextNextIt)->asSimpleName()
|
||||
|| (*nextNextIt)->asQualifiedName()
|
||||
|| (*nextNextIt)->asTemplateId());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user