Bug 264482 - kdevelop enforces usage of {braces} around switch cases
Summary: kdevelop enforces usage of {braces} around switch cases
Status: RESOLVED DUPLICATE of bug 204665
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.1.60
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-27 14:44 UTC by Émeric Dupont
Modified: 2013-03-31 00:48 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Émeric Dupont 2011-01-27 14:44:46 UTC
Version:           4.1.60 (using KDE 4.6.0) 
OS:                Linux

Google test (http://code.google.com/p/googletest/) uses macros in the form "switch (0) case 0: if (true) ; else ;" for its ASSERT_* macros. Since there is only one case in the switch, curly braces should not be required around it.

However, when parsing such a line, kdevelop displays an error "Unexpected token 'case'".



Reproducible: Always

Steps to Reproduce:
$ cat << EOF > main.cpp
int main()
{
    switch (0) case 0: if (true) ; else return 1;
    return 0;
}
EOF

# Make sure the code is legit:
$ g++ --version
g++ (GCC) 4.5.2
$ g++ -ansi -Wall -pedantic main.cpp

# Open main.cpp in kdevelop
# Toggle 'Problems' tool view open

Actual Results:  
The "switch" line is highlighted, and the problem "Unexpected token 'case'" appears line 3 column 16.

Expected Results:  
There should be no problem shown on this line.

"switch (0) { case 0: if (true) ; else return 1; }" is a syntax accepted by kdevelop.
Comment 1 Sebastian Dörner 2011-01-27 21:44:40 UTC

*** This bug has been marked as a duplicate of bug 204665 ***
Comment 2 Aleix Pol 2013-03-31 00:48:30 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively