Bug 375635 - Wrong code completion on switch with strongly-typed enum
Summary: Wrong code completion on switch with strongly-typed enum
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (other bugs)
Version First Reported In: 5.1.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL: https://phabricator.kde.org/D10738
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-28 01:22 UTC by Nicolás Alvarez
Modified: 2018-03-01 21:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.2.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2017-01-28 01:22:15 UTC
In a switch() statement that takes an enum-class type, code completion on the 'case' shows the possible enumerators, but doesn't include the enum name for scoping, so the resulting code doesn't compile.

Example:

enum class Color {
    Red, Yellow, Green, Blue
};
void foo() {
    Color x;
    switch (x) {
        case //complete here
    }
}

The code completion shows 'Red', 'Yellow', 'Green' and 'Blue' as options, but doesn't include the Color:: part, leaving 'case Red:' which is invalid for strongly-typed enums.