=?utf-8?q?André?= Brand <andre.br...@mailbox.org> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/121...@github.com>
================ @@ -1571,6 +1571,23 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { Enum->setIntegerType(SemaRef.Context.IntTy); else Enum->setIntegerTypeSourceInfo(NewTI); + + // The following lines are relevant for opaque-enum-declarations. + // If users declare a full enum-specifier, the promotion type is reset + // again when parsing the (potentially empty) enumerator-list. + // We implement the same logic from C++11 [conv.prom] p4 here but only + // after template specialization [temp.spec.general] because it requires + // the concrete type. + // Note that (1) this also correctly handles the non-dependent case, + // (2) we set the promotion type for scoped enumerations to ensure + // consistency with declarations outside of templates, (3) we guarantee a + // valid promotion even if the user provided an invalid underlying type + // (fallback to "default int"). ---------------- cor3ntin wrote: ```suggestion // C++23 [conv.prom]p4 // if integral promotion can be applied to its underlying type, a prvalue of an unscoped enumeration type // whose underlying type is fixed can also be converted to a prvalue of the promoted underlying type. // // FIXME: that logic is already implemented in ActOnEnumBody, factor out into (Re)BuildEnumBody. ``` https://github.com/llvm/llvm-project/pull/121039 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits