https://bugs.llvm.org/show_bug.cgi?id=47112
Bug ID: 47112
Summary: Need a pedantic warning for switch statements with
implicit default
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
I learned recently that the C++ standard allows enums to contain values that
aren't valid, therefore a "covered" switch without a default might not handle
all values from the perspective of the standard.
It would be nice if this scenario had an opt-in pedantic warning. For example:
enum class Foo { A, B, C };
int exampleCoveredSwitch(Foo foo) {
switch (foo) {
case Foo::A: return 12;
case Foo::B: return 34;
case Foo::C: return 56;
}
// some kind of opt-in warning here about returning from a non-void
function
}
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs