Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -13533,7 +13533,9 @@ return Info.Ctx.getTypeSize(DestType) == Info.Ctx.getTypeSize(SrcType); } - if (Info.Ctx.getLangOpts().CPlusPlus && DestType->isEnumeralType()) { + if (Info.Ctx.getLangOpts().CPlusPlus && + Info.EvalMode == EvalInfo::EM_ConstantExpression && + DestType->isEnumeralType()) { const EnumType *ET = dyn_cast(DestType.getCanonicalType()); const EnumDecl *ED = ET->getDecl(); // Check that the value is within the range of the enumeration values.