[flang-commits] [clang] [flang] [flang] Enumeration Type: (PR 5/5) Enable (PR #231641)

via flang-commits flang-commits at lists.llvm.org
Mon Oct 19 12:51:08 PDT 2026


================
@@ -6580,16 +6568,6 @@ void DeclarationVisitor::Post(const parser::EnumDef &) {
 // F2023 R766 EnumerationTypeDef — scope is pushed in Post(EnumerationTypeStmt)
 // and popped in Post(EndEnumerationTypeStmt).
 bool DeclarationVisitor::Pre(const parser::EnumerationTypeDef &x) {
-  const auto &source{
-      std::get<parser::Statement<parser::EnumerationTypeStmt>>(x.t).source};
-  // ENUMERATION TYPE is an experimental feature: semantics are partially
-  // implemented.  FIR lowering is not implemented.
-  if (!context().IsEnabled(common::LanguageFeature::EnumerationType)) {
-    Say(source, "F2023 ENUMERATION TYPEs are not yet implemented"_err_en_US);
-    return false;
-  }
-  Say(source,
-      "ENUMERATION TYPE support is incomplete and should be enabled only for testing"_warn_en_US);
   BeginAttrs();
----------------
kwyatt-ext wrote:

(Used AI for references, but the reply is mine.)
Yes, C712 by itself doesn't exclude an enumeration type. It seems it also doesn't exclude SEQUENCE or BIND(C) derived types either, but Flang already rejects CLASSOF of any non-extensible type. This would following existing behavior and IsExtensibleType() now follows 7.5.7.1, rejecting enumeration types.

A polymorphic entity is one that is "able to be of differing dynamic types" (7.3.2.3). Type extension is defined only for derived types (7.5.7), and an enumeration type specifically isn't a derived type. Also a CLASSOF(enum) entity could only ever have its declared type and C705 already prohibits the equivalent CLASS(state).

I've added a note on this to Extensions.md under "Standard features not silently accepted".

Because neither CLASS nor CLASSOF of an enumeration type is now accepted, the form that failed to read back can no longer be written to a module file. I added a multi-file module round-trip test.

https://github.com/llvm/llvm-project/pull/231641


More information about the flang-commits mailing list