Bug 256071 - KDevelop does not flag uses of non-static field from static member function as illegal
Summary: KDevelop does not flag uses of non-static field from static member function a...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.1.60
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-04 19:58 UTC by Nathaniel
Modified: 2016-09-08 20:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathaniel 2010-11-04 19:58:45 UTC
Version:           4.1.60 (using KDE 4.5.2) 
OS:                Linux

Example:
class X {
public:
   int x;
   static int getX();
}

int X::getX() {
   return x;
}

getX is a static function, therefore it cannot access non-static variable x. However, KDevelop does not flag this. Perhaps it could have one of those handy assistants pop up and ask to change x to be a static field. In any event, it should flag the reference to x as illegal.

Reproducible: Always

Steps to Reproduce:
Type the code above into a project

Actual Results:  
KDevelop highlights x as a static field, with no complaints

Expected Results:  
Should mark x as something illegal, preferably with a note that x is not static, so a static function cannot access it.
Comment 1 Kevin Funk 2016-09-08 20:34:43 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.

Note: Tested this; KDevelop correctly flags this as invalid code.