diff --git a/src/plugins/cppeditor/cpplocalsymbols.cpp b/src/plugins/cppeditor/cpplocalsymbols.cpp
index c5a2b7a2a8126521c954027e5390f9059ff552f1..167ce9da464555f181519242b1d8cb306b3f7652 100644
--- a/src/plugins/cppeditor/cpplocalsymbols.cpp
+++ b/src/plugins/cppeditor/cpplocalsymbols.cpp
@@ -148,6 +148,23 @@ protected:
         return true;
     }
 
+    virtual bool visit(CastExpressionAST *ast)
+    {
+        if (ast->expression && ast->expression->asUnaryExpression()) {
+            TypeIdAST *typeId = ast->type_id->asTypeId();
+            if (typeId && !typeId->declarator && typeId->type_specifier_list && !typeId->type_specifier_list->next) {
+                if (NamedTypeSpecifierAST *namedTypeSpec = typeId->type_specifier_list->value->asNamedTypeSpecifier()) {
+                    if (checkLocalUse(namedTypeSpec->name, namedTypeSpec->firstToken())) {
+                        accept(ast->expression);
+                        return false;
+                    }
+                }
+            }
+        }
+
+        return true;
+    }
+
     virtual bool visit(QtMemberDeclarationAST *ast)
     {
         if (tokenKind(ast->q_token) == T_Q_D)