Version: 4.2.0 (using KDE 4.6.0) OS: Linux When given the following (valid) lines of code, the cpp parser doesn't parse them - instead it says there's an error. Reproducible: Always Steps to Reproduce: /* error at [ inside initialization */ static char buffer[TESTDATA_LENGTH] = { [0 ... TESTDATA_LENGTH - 1] = 0 }; /* error at 'c' in (char*[]) */ char **blah = (char *[]){"abc", "def", NULL}; Expected Results: both constructs are valid and compilable (at least using gcc)
Without any special flags I cannot compile this using g++ - this is non-standard anyways, or? Anyways, I'll need a full, compilable minimal example along with the g++ invocation required to compile it. Also a link to the standard that explains this syntax. What I could understand (but is properly parsed by KDevelop afaik) is the brace-initializer syntax from C++11: const char *blah[2] = {"abc", "def"};
They are both C constructs, compiles fine for me in C99 mode. - Feature 1 is called 'designated initializers' (http://tigcc.ticalc.org/doc/gnuexts.html#SEC82) - Feature 2 is using 'compound literals' on the right side of the assignment (http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Compound-Literals.html) - but the report is a duplicate of https://bugs.kde.org/show_bug.cgi?id=246026 (which I have a fix for in the pipeline)
I'm fixing the bug title; The issue is that designated initializers "static char buffer[TESTDATA_LENGTH] = { [0 ... TESTDATA_LENGTH - 1] = 0 };" are not recognized. Here's another issue dealing with *structure* initializers: https://bugs.kde.org/show_bug.cgi?id=280591 (structure initializers are a subset of designated initializers).
Hello! We worked 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 https://www.kdevelop.org/news/kdevelop-500-released 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 try out KDevelop 5, either by downloading it through your distro, or by playing around with the AppImage:. 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. Sorry for the inconvenience, I hope you understand the reasoning above. Cheers
In kdevelop5 it really looks OK. Thanks for all the clang work, great stuff!