[PATCH] D27299: [Sema] C++11 opaque enums should avoid the "case value not in enumerated type" switch warning
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 5 09:49:15 PST 2016
arphaman added inline comments.
================
Comment at: lib/Sema/SemaStmt.cpp:1165
if (!hasCasesNotInSwitch)
SS->setAllEnumCasesCovered();
----------------
ahatanak wrote:
> This function used to call setAllEnumCasesCovered() when parsing a switch statement with an opaque enum condition, but this patch changes the behavior. I couldn't tell whether isAllEnumCasesCovered should return true or false for such switch statements, but was this change intentional?
You're right, good catch! Originally it wasn't intentional, but I've looked over this change and it seems like the right change to me. We can't know if we actually covered all enum cases when checking an opaque enum because we don't know which cases the enum has (unless we have a switch that covers all the of possible values of the enum's integer type)! It seems that the previous behaviour was incorrect.
Repository:
rL LLVM
https://reviews.llvm.org/D27299
More information about the cfe-commits
mailing list