diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -2428,6 +2428,13 @@ if (allowForwardReference && ImplicitlyTypeForwardRef(symbol)) { return; } + if (const auto *entity{symbol.detailsIf()}; + entity && entity->isDummy()) { + // Dummy argument, no declaration or reference; if it turns + // out to be a subroutine, it's fine, and if it is a function + // or object, it'll be caught later. + return; + } if (!context().HasError(symbol)) { Say(symbol.name(), "No explicit type declared for '%s'"_err_en_US); context().SetError(symbol); diff --git a/flang/test/Semantics/implicit13.f90 b/flang/test/Semantics/implicit13.f90 new file mode 100644 --- /dev/null +++ b/flang/test/Semantics/implicit13.f90 @@ -0,0 +1,9 @@ +! RUN: %python %S/test_errors.py %s %flang_fc1 +!ERROR: No explicit type declared for 'func' +!ERROR: No explicit type declared for 'obj' +subroutine implicit_none(func, sub, obj) + implicit none + call sub ! ok + print *, func() + print *, obj +end