Bug 271080

Summary: Admittedly-strange variable declaration syntax not supported
Product: [Applications] kdevelop Reporter: Nicolás Alvarez <nalvarez>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: minor    
Priority: NOR    
Version First Reported In: 4.2.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nicolás Alvarez 2011-04-16 06:17:32 UTC
I just discovered that "int(foo);" as a lone statement (not in the middle of an expression) is equivalent to "int foo;", declaring a variable called 'foo' with type 'int'.

KDevelop doesn't support this, and underlines 'foo' in yellow. It probably thinks it's a cast.

The strange thing is that in this code snippet:
int func(double foo) {
    int(foo);
}
if the function parameter is called the same as the variable, then KDevelop does *not* underline the second 'foo' in yellow as an error. However, it says both are different variables, so it doesn't seem to be interpreting it as a cast either... (the correct way for a compiler to handle this code is to error out because a local variable is declared with the same name as an argument)
Comment 1 Kevin Funk 2018-03-25 22:30:48 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.