[flang] Expunge bogus semantic check for ELEMENTAL without dummies
Semantics refuses valid ELEMENTAL subprograms without dummy arguments,
but there's no such constraint in the standard; indeed, subclause
15.8.2 discusses the meaning of calls to ELEMENTAL functions with
arguments. Remove the check and its test.
Differential Revision: https://reviews.llvm.org/D111832
GitOrigin-RevId: 1062f989af23c52a472892ff54a55557fca35528
diff --git a/lib/Semantics/check-declarations.cpp b/lib/Semantics/check-declarations.cpp
index 2ff39ee..21ca312 100644
--- a/lib/Semantics/check-declarations.cpp
+++ b/lib/Semantics/check-declarations.cpp
@@ -899,9 +899,6 @@
// See comment on the similar check in CheckProcEntity()
if (details.isDummy()) {
messages_.Say("A dummy procedure may not be ELEMENTAL"_err_en_US);
- } else if (details.dummyArgs().empty()) {
- messages_.Say(
- "An ELEMENTAL subprogram must have at least one dummy argument"_err_en_US);
} else {
for (const Symbol *dummy : details.dummyArgs()) {
if (!dummy) { // C15100
diff --git a/test/Semantics/elemental01.f90 b/test/Semantics/elemental01.f90
index 2484776..8a80727 100644
--- a/test/Semantics/elemental01.f90
+++ b/test/Semantics/elemental01.f90
@@ -1,11 +1,6 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
! Tests ELEMENTAL subprogram constraints C15100-15102
-!ERROR: An ELEMENTAL subprogram must have at least one dummy argument
-elemental integer function noargs
- noargs = 1
-end function
-
!ERROR: An ELEMENTAL subroutine may not have an alternate return dummy argument
elemental subroutine altret(*)
end subroutine