diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md index 49e78a10fa6bc..4d0b2c7319818 100644 --- a/flang/docs/Extensions.md +++ b/flang/docs/Extensions.md @@ -428,6 +428,9 @@ end * Since Fortran 90, INCLUDE lines have been allowed to have a numeric kind parameter prefix on the file name. No other Fortran compiler supports them that I can find. +* A `SEQUENCE` derived type is required (F'2023 C745) to have + at least one component. No compiler enforces this constraint; + this compiler emits a warning. ## Behavior in cases where the standard is ambiguous or indefinite diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index 865c198424696..f56f7a71f367b 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -5225,9 +5225,10 @@ bool DeclarationVisitor::Pre(const parser::DerivedTypeDef &x) { Walk(componentDefs); if (derivedTypeInfo_.sequence) { details.set_sequence(true); - if (componentDefs.empty()) { // C740 + if (componentDefs.empty()) { + // F'2023 C745 - not enforced by any compiler Say(stmt.source, - "A sequence type must have at least one component"_err_en_US); + "A sequence type should have at least one component"_warn_en_US); } if (!details.paramNames().empty()) { // C740 Say(stmt.source, diff --git a/flang/test/Semantics/resolve31.f90 b/flang/test/Semantics/resolve31.f90 index 0c604c0ee9734..6bf8e877a5156 100644 --- a/flang/test/Semantics/resolve31.f90 +++ b/flang/test/Semantics/resolve31.f90 @@ -68,7 +68,7 @@ module m4 !ERROR: A sequence type may not have a CONTAINS statement contains end type - !ERROR: A sequence type must have at least one component + !WARNING: A sequence type should have at least one component type :: emptyType sequence end type emptyType