[flang-commits] [clang] [flang] [flang] Enumeration Type: (PR 5/5) Enable (PR #231641)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 15 16:51:50 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();
----------------
MattPD wrote:
With this PR, `flang -fsyntax-only repro.f90` silently accepts the `EXTENDS(color)` and `CLASS(color)` declarations in this reproducer. [F2023 C705](https://j3-fortran.org/doc/year/24/24-007.pdf#page=77) and [F2023 C737](https://j3-fortran.org/doc/year/24/24-007.pdf#page=88) require extensible types for these declarations, but enumeration types are not derived types. Could we diagnose both declarations before enabling the feature by default?
```fortran
module m
enumeration type :: color
enumerator :: red, green
end enumeration type
type, extends(color) :: child
end type
class(color), allocatable :: x
end module
```
At the PR's [merge base](https://github.com/llvm/llvm-project/commit/98e192149130062205de65a947b762f58d76d9bd), Flang rejects this reproducer by default. With `-fenumeration-type`, Flang accepts both declarations and emits the experimental-support warning.
https://github.com/llvm/llvm-project/pull/231641
More information about the flang-commits
mailing list