================ @@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) { + // Incomplete enum types are not treated as integer types. + // FIXME: In C++, enum types are never integer types. + return IsEnumDeclComplete(ET->getDecl()) && + !IsEnumDeclScoped(ET->getDecl()) && ---------------- rjmccall wrote:
C specifies that "enumerated types" are integer types, and C++ does not, and `isIntegerType` is trying to honor that as best it can. It's one of those situations where we need to ask what callers actually want, because in most cases it's probably not this language-specific formal property. If `hasIntegerRepresentation` is really a question about the representation of the type, it should be ignoring scoped-ness of enums. But it seems to be used in Sema in ways that should definitely exclude scoped enums, like the semantic analysis of `__builtin_shuffle_vector` and vector math. `isBooleanType` should probably continue to check only for `bool`. It seems reasonable for `hasBooleanRepresentation` to look through enums, though, and it should probably ignore the scoped-ness of the enum. https://github.com/llvm/llvm-project/pull/136038 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits