[flang-commits] [flang] [llvm] [flang] Enumeration Type: (PR 3/5) Intrinsics + I/O + Modules (PR #193235)
via flang-commits
flang-commits at lists.llvm.org
Wed Jul 1 00:22:35 PDT 2026
================
@@ -2976,7 +2988,7 @@ bool IntrinsicProcTable::Implementation::IsIntrinsicFunction(
}
// special cases
return name == "__builtin_c_loc" || name == "__builtin_c_devloc" ||
- name == "null";
+ name == "null" || name == "next" || name == "previous";
----------------
MattPD wrote:
Should recognizing `next`/`previous` as intrinsic names here be gated behind the enumeration-type feature? As written they are reserved for every compilation, including default (pre-F2023) mode, so a reference to an implicit-external procedure named `next` or `previous` fails to compile:
```fortran
program p
integer :: i
i = next(5) ! compiled without -fenumeration-type
end program
```
The compiler reports `error: Internal error: Expression analysis failed on: ... Name = 'next'`, whereas the same program with any other name (`foo(5)`) compiles cleanly as an implicit external. The internal error also appears with `-fenumeration-type` enabled whenever the argument is not an enumeration type, because the enum dispatch returns `nullopt` without emitting a diagnostic. Would gating the `next`/`previous` recognition behind `LanguageFeature::EnumerationType`, plus a proper "argument must be of enumeration type" diagnostic for the non-enum case, be reasonable?
https://github.com/llvm/llvm-project/pull/193235
More information about the flang-commits
mailing list