[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-bugs
Subject:    [Bug 264482] New: kdevelop enforces usage of {braces} around switch
From:       Émeric Dupont <emeric.dupont () agol ! org>
Date:       2011-01-27 13:44:47
Message-ID: bug-264482-40295 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=264482

           Summary: kdevelop enforces usage of  {braces} around switch
                    cases
           Product: kdevelop
           Version: 4.1.60
          Platform: Archlinux Packages
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: cpp-parser
        AssignedTo: kdevelop-bugs@kdevelop.org
        ReportedBy: emeric.dupont@agol.org


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.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

_______________________________________________
KDevelop-bugs mailing list
KDevelop-bugs@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic