Bug 238250 - Friend functions mistaken for member functions
Summary: Friend functions mistaken for member functions
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-20 01:44 UTC by Nicolás Alvarez
Modified: 2018-03-25 22:25 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2010-05-20 01:44:47 UTC
Version:           4.0.60 (using KDevPlatform 1.0.60) (using 4.4.3 (KDE 4.4.3), Debian packages)
OS:                Linux (x86_64) release 2.6.32-3-amd64

Create foo.h, and type this:

class Foo {
public:
    friend int do_something(Foo& foo);
};

Move mouse over do_something. The tooltip says Foo is the function's container; but do_something is not even a member function.

Create foo.cpp, and type this:

#include "foo.h"

Then go to the next empty line and press Ctrl-Space. It offers "Implement Function: Implement int Foo::do_something(Foo& foo)".

Press Enter on that completion item. KDevelop inserts the following code:
int Foo::do_something(Foo& foo)
{

}

g++ 4.4.4 gives the following error when compiling that generated code:
foo.cpp:7: error: no ‘int Foo::do_something(Foo&)’ member function declared in class ‘Foo’

Both the completion item and the inserted code have "Foo::", which is incorrect. do_something is a normal function and a friend of class Foo, not a member function of Foo.
Comment 1 Bastian 2012-09-28 07:01:12 UTC
Is this bug not fixable?
Comment 2 ryuta 2013-04-01 12:39:29 UTC
I have the same on 4.10.1 on Linux.
(commit 6cc190f8f4043dcd8e0c47c1cfdda6108d7a0dae
Date:   Sun Mar 31 09:52:51 2013 +0200)

Regards.
Comment 3 Kevin Funk 2018-03-25 22:25:45 UTC
Hello!

We are working on a new clang-based C/C++ language plugin for KDevelop 5 which
supersedes the old C++ plugin in KDevelop 4. See e.g.:
https://www.kdevelop.org/news/first-beta-release-kdevelop-500-available

Due to a lack of manpower, we cannot fix bugs in the old C++ plugin. We rather
want to supply a good Clang based C++ experience for KDevelop 5 than wasting
our time on the legacy C++ support for KDevelop 4.

With the new clang-based C/C++ language plugin, the bug presented here does not
occur. In my testing. For these reasons, I'll close this bug. Please stay tuned
for KDevelop 5.

If you think this bug is applicable to Clang/KDevelop 5, please reopen the
report and add new information on how to reproduce the bug there.