diff --git a/src/libs/cplusplus/ExpressionUnderCursor.cpp b/src/libs/cplusplus/ExpressionUnderCursor.cpp index 9cbaeb97539dbc61a1df3d2ad014db5e4a60e99d..53dc9b4f2d114efa47d7c8b9e868939eb97121bd 100644 --- a/src/libs/cplusplus/ExpressionUnderCursor.cpp +++ b/src/libs/cplusplus/ExpressionUnderCursor.cpp @@ -265,9 +265,14 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) break; else if (tk.is(T_LPAREN)) return startPosition + tk.position(); - else if (tk.is(T_RPAREN)) - index = startOfMatchingBrace(tokens, index); - else + else if (tk.is(T_RPAREN)) { + int matchingBrace = startOfMatchingBrace(tokens, index); + + if (matchingBrace == index) // If no matching brace found + return -1; + + index = matchingBrace; + } else --index; }