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: unassignedclangb...@nondot.org
Reporter: d...@znu.io
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs