SUMMARY KDevelop analyzes a variable declaration right at the beginning of a case block incorrectly, leading to an error while the code still compiles. Minimal reproducible case: // test.c int main() { switch (0) { case 0: int i; // error: Expected expression } return 0; } After changing this code to the following, the error goes away: // test.c int main() { switch (0) { case 0: 0; // <- inserted line, any statement will do int i; } return 0; } STEPS TO REPRODUCE 1. Declare a variable immediately after a case label in a switch statement OBSERVED RESULT KDevelop will show an "Expected expression" error after the variable declaration EXPECTED RESULT KDevelop parses the code correctly as a variable declaration SOFTWARE/OS VERSIONS Operating System: Gentoo 2.8 KDE Plasma Version: 5.22.90 KDE Frameworks Version: 5.86.0 Qt Version: 5.15.2 Kernel Version: 5.14.8-gentoo-dist (64-bit) Graphics Platform: Wayland Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor Memory: 23.4 GiB of RAM Graphics Processor: Radeon RX Vega ADDITIONAL INFORMATION
I can't reproduce this behavior. Are you sure parsing has actually finished after you changed the code? It's very unlikely that there is a bug here because parsing is handled by clang.
Ah, I see. Yeah, parsing is finished and this persists across restarts of KDevelop, happens in multiple locations and also with a new project (Standard -> Terminal template). It's probably a clang bug then, did you test it with clang 13.0.0?
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!