forked from OSchip/llvm-project
[Clang] Fix for Tighten restrictions on enum out of range diagnostic
Ok it looks like this is a bit more subtle, I broke the llvm-test-suite file paq8p.cpp again. We need both conditions to be true Info.EvalMode == EvalInfo::EM_ConstantExpression && Info.InConstantContext. We need to be in a context that requires a constant value but also in a constant expression context. Differential Revision: https://reviews.llvm.org/D131704
This commit is contained in:
parent
28d0c0c2c8
commit
106774515b
|
@ -13534,6 +13534,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
|
|||
}
|
||||
|
||||
if (Info.Ctx.getLangOpts().CPlusPlus && Info.InConstantContext &&
|
||||
Info.EvalMode == EvalInfo::EM_ConstantExpression &&
|
||||
DestType->isEnumeralType()) {
|
||||
const EnumType *ET = dyn_cast<EnumType>(DestType.getCanonicalType());
|
||||
const EnumDecl *ED = ET->getDecl();
|
||||
|
|
Loading…
Reference in New Issue