diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp
index ffcd4aa217b9d87c93be047d44a60815e0b27c04..8f98fe878425e2e4419b6408e28e96b1cfadf34d 100644
--- a/src/shared/cplusplus/Bind.cpp
+++ b/src/shared/cplusplus/Bind.cpp
@@ -1544,6 +1544,12 @@ bool Bind::visit(SimpleDeclarationAST *ast)
 
         Declaration *decl = control()->newDeclaration(sourceLocation, declName);
         decl->setType(declTy);
+
+        if (Function *fun = decl->type()->asFunctionType()) {
+            if (declaratorId && declaratorId->name)
+                fun->setName(declaratorId->name->name); // update the function name
+        }
+
         if (_scope->isClass()) {
             decl->setVisibility(_visibility);
 
@@ -1697,6 +1703,10 @@ bool Bind::visit(FunctionDefinitionAST *ast)
             fun->setVisibility(_visibility);
             fun->setMethodKey(_methodKey);
         }
+
+        if (declaratorId && declaratorId->name)
+            fun->setName(declaratorId->name->name);
+
         _scope->addMember(fun);
     } else
         translationUnit()->warning(ast->firstToken(), "expected a function declarator");