[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
Sat Aug 1 00:52:40 PDT 2026
================
@@ -1289,6 +1428,31 @@ void IoChecker::CheckNamelist(const Symbol &namelist, common::DefinedIo which,
const auto &details{namelist.GetUltimate().get<NamelistDetails>()};
for (const Symbol &object : details.objects()) {
context_.CheckIndexVarRedefine(namelistLocation, object);
+ if (auto type{evaluate::DynamicType::From(object)};
+ type && type->category() == TypeCategory::Derived) {
+ const auto &derived{type->GetDerivedTypeSpec()};
+ if (const auto *dtDetails{
+ derived.typeSymbol().detailsIf<DerivedTypeDetails>()}) {
+ if (dtDetails->isEnumerationType()) {
+ context_.Say(namelistLocation,
+ "Enumeration type '%s' may not be a namelist group object"_err_en_US,
+ derived.name());
+ continue;
+ }
+ }
+ // A namelist group object of derived type that is not processed by
+ // defined I/O expands into its components (F2023 12.6.3), so reject one
+ // that reaches an enumeration effective item.
+ const Scope &scope{context_.FindScope(namelistLocation)};
+ if (!HasDefinedIo(which, derived, &scope)) {
+ if (const Symbol *bad{
+ FindEnumerationTypeComponent(which, derived, scope)}) {
+ context_.Say(namelistLocation,
+ "Namelist group object '%s' has a direct component '%s' of enumeration type"_err_en_US,
----------------
MattPD wrote:
The nested case now reads "has a component", matching the list-directed messages.
https://github.com/llvm/llvm-project/pull/193235
More information about the flang-commits
mailing list