[flang-commits] [flang] [flang] Enumeration Type: (PR 4/5) Lowering (PR #193571)

via flang-commits flang-commits at lists.llvm.org
Thu Oct 1 19:49:57 PDT 2026


================
@@ -385,6 +385,17 @@ struct TypeBuilderImpl {
     if (tySpec.IsVectorType()) {
       return genVectorType(tySpec);
     }
+    // Check the type symbol's DerivedTypeDetails for the enumeration flag,
+    // because some DerivedTypeSpec instances may not have the
+    // EnumerationType category set (e.g., those created during USE
+    // association or variable declarations).
+    if (const auto *dtDetails =
+            tySpec.typeSymbol()
+                .detailsIf<Fortran::semantics::DerivedTypeDetails>()) {
+      if (dtDetails->isEnumerationType()) {
+        return mlir::IntegerType::get(&converter.getMLIRContext(), 32);
----------------
MattPD wrote:

Confirmed: SELECT TYPE now distinguishes enumeration values from INTEGER under both guard orders, and typed CLASS(*) allocation works.

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


More information about the flang-commits mailing list