================ @@ -10488,7 +10488,14 @@ static bool AnalyzeBitFieldAssignment(Sema &S, FieldDecl *Bitfield, Expr *Init, // The RHS is not constant. If the RHS has an enum type, make sure the // bitfield is wide enough to hold all the values of the enum without // truncation. - if (const auto *EnumTy = OriginalInit->getType()->getAs<EnumType>()) { + const auto *EnumTy = OriginalInit->getType()->getAs<EnumType>(); + const PreferredTypeAttr *PTAttr = nullptr; + if (!EnumTy) { + PTAttr = Bitfield->getAttr<PreferredTypeAttr>(); + if (PTAttr) + EnumTy = PTAttr->getType()->getAs<EnumType>(); + } + if (EnumTy) { ---------------- tbaederr wrote:
Just read this again and what I said makes no sense. https://github.com/llvm/llvm-project/pull/116785 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits