llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> This happens for enum types with bool parent types. isBooleanType() returns false for them however. The previous version did the same thing by re-classifying the enum integer type, but that breaks with forward-declared enums. --- Full diff: https://github.com/llvm/llvm-project/pull/104662.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Context.cpp (+3-3) - (modified) clang/test/AST/ByteCode/c.c (+2-1) ``````````diff diff --git a/clang/lib/AST/ByteCode/Context.cpp b/clang/lib/AST/ByteCode/Context.cpp index e9c1fd1b8dc9f..48ae363f651f5 100644 --- a/clang/lib/AST/ByteCode/Context.cpp +++ b/clang/lib/AST/ByteCode/Context.cpp @@ -135,9 +135,6 @@ std::optional<PrimType> Context::classify(QualType T) const { if (T->isAnyComplexType() || T->isVectorType()) return std::nullopt; - if (const auto *ET = T->getAs<EnumType>()) - return classify(ET->getDecl()->getIntegerType()); - if (T->isSignedIntegerOrEnumerationType()) { switch (Ctx.getIntWidth(T)) { case 64: @@ -163,6 +160,9 @@ std::optional<PrimType> Context::classify(QualType T) const { return PT_Uint16; case 8: return PT_Uint8; + case 1: + // Might happen for enum types. + return PT_Bool; default: return PT_IntAP; } diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c index 13a5e082a125f..b38259d41130e 100644 --- a/clang/test/AST/ByteCode/c.c +++ b/clang/test/AST/ByteCode/c.c @@ -295,4 +295,5 @@ void T1(void) { // pedantic-warning {{use of GNU statement expression extension}} } - +enum teste1 test1f(void), (*test1)(void) = test1f; // pedantic-warning {{ISO C forbids forward references to 'enum' types}} +enum teste1 { TEST1 }; `````````` </details> https://github.com/llvm/llvm-project/pull/104662 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits