Bug 375635

Summary: Wrong code completion on switch with strongly-typed enum
Product: [Applications] kdevelop Reporter: Nicolás Alvarez <nalvarez>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.1.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://phabricator.kde.org/D10738
Latest Commit: Version Fixed/Implemented In: 5.2.2
Sentry Crash Report:

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.