CppTools: Do not highlight instantiation as call

Underlying C++ model sometimes marks C++ object instantiation using initializer
as a (forward) function declaration. This leads to incorrect highlighting of
object variables as if they were function calls.

C++ model however marks in this case (and not any other case) such symbols as
ambiguous function types, see CPlusPlus::Bind::visit. This change skips such
ambiguous functions for highlighting as function call.

Also add test case for related bug report.

Task-number: QTCREATORBUG-15212
Change-Id: Ifde8db407f2fa8275a3f991bfa3d3b73eca8c14e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Adam Strzelecki
2015-10-20 20:12:09 +02:00
committed by Orgad Shaneh
parent 87f6b92e34
commit 9b3723d6f4
2 changed files with 50 additions and 1 deletions

View File

@@ -1298,7 +1298,7 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
Function *funTy = c->type()->asFunctionType();
if (!funTy) // Template function has an overridden type
funTy = r.type()->asFunctionType();
if (!funTy)
if (!funTy || funTy->isAmbiguous())
continue; // TODO: add diagnostic messages and color call-operators calls too?
if (argumentCount < funTy->minimumArgumentCount()) {