<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>264482</bug_id>
          
          <creation_ts>2011-01-27 14:44:46 +0000</creation_ts>
          <short_desc>kdevelop enforces usage of  {braces} around switch cases</short_desc>
          <delta_ts>2013-03-31 00:48:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>kdevelop</product>
          <component>Language Support: CPP (old)</component>
          <version>4.1.60</version>
          <rep_platform>Arch Linux</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>204665</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.2.0</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Émeric Dupont">emeric.dupont</reporter>
          <assigned_to>kdevelop-bugs-null</assigned_to>
          <cc>sebastian</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1079408</commentid>
    <comment_count>0</comment_count>
    <who name="Émeric Dupont">emeric.dupont</who>
    <bug_when>2011-01-27 14:44:46 +0000</bug_when>
    <thetext>Version:           4.1.60 (using KDE 4.6.0) 
OS:                Linux

Google test (http://code.google.com/p/googletest/) uses macros in the form &quot;switch (0) case 0: if (true) ; else ;&quot; 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 &quot;Unexpected token &apos;case&apos;&quot;.



Reproducible: Always

Steps to Reproduce:
$ cat &lt;&lt; EOF &gt; 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 &apos;Problems&apos; tool view open

Actual Results:  
The &quot;switch&quot; line is highlighted, and the problem &quot;Unexpected token &apos;case&apos;&quot; appears line 3 column 16.

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

&quot;switch (0) { case 0: if (true) ; else return 1; }&quot; is a syntax accepted by kdevelop.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1079637</commentid>
    <comment_count>1</comment_count>
    <who name="Sebastian Dörner">sebastian</who>
    <bug_when>2011-01-27 21:44:40 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 204665 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1355858</commentid>
    <comment_count>2</comment_count>
    <who name="Aleix Pol">aleixpol</who>
    <bug_when>2013-03-31 00:48:30 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>