Bug 246026 - KDevelop editor doesn't parse C99 compound literals
Summary: KDevelop editor doesn't parse C99 compound literals
Status: RESOLVED DUPLICATE of bug 57156
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 4.0.1
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-28 14:43 UTC by Leandro Santiago da Silva
Modified: 2012-12-02 23:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leandro Santiago da Silva 2010-07-28 14:43:26 UTC
Version:           SVN (using KDE 4.4.5) 
OS:                Linux

In my project I'm using a struct type called AVRational:

typedef struct AVRational{
    int num; ///< numerator
    int den; ///< denominator
} AVRational;

And declare an AVRational:
AVRational i;

If I try to set this struct:
i = (AVRational){1,10};

KDevelop editor doesn't parse this instruction. I think this syntax is correct in c/c++ because the program compiles fine.

Reproducible: Didn't try

Steps to Reproduce:
Create a new C file with this contents:

#include <stdio.h>

typedef struct MyStruct {
  int num;
  int den;
} MyType;

int main() {
  MyType i;
  i = (MyType){1,13};

  printf("%d and %d\n",i.num,i.den);
  
  return 1;
}

And compiles with:
gcc teste.c -o teste -Wall

Or: 
clang teste.c -o teste

Or:
tcc teste.c -o teste

I've used just these three compilers and all them compile fine and don't show any warning messages.
Comment 1 Nicolás Alvarez 2011-05-29 03:23:21 UTC
This is actually called a "compound literal".
Comment 2 Damian Kaczmarek 2011-12-20 13:20:36 UTC
This doesn't work for me as well, as shown on the screenshot: http://rushbase.net/stuff/kdevelop_weird_problems.png
Comment 3 Milian Wolff 2012-11-02 15:37:04 UTC
related: https://bugs.kde.org/show_bug.cgi?id=57156
Comment 4 Kevin Funk 2012-12-02 23:16:00 UTC
It's not just related, it's a clear duplicate - both handle C99 compound literals.

I have a fix for that, going to push it to reviewboard soon.

*** This bug has been marked as a duplicate of bug 57156 ***