xref: /llvm-project/flang/test/Semantics/present01.f90 (revision 3bca8506ab65c66e32695ba50571c4384be8e4d1)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2module m
3  type dt
4    real a
5  end type
6 contains
7  subroutine s(a,b,p,unl)
8    type(dt), optional :: a(:), b
9    procedure(sin), optional :: p
10    type(*), optional :: unl
11    print *, present(a) ! ok
12    print *, present(p) ! ok
13    print *, present(unl) ! ok
14    !ERROR: Argument of PRESENT() must be the name of a whole OPTIONAL dummy argument
15    print *, present(a(1))
16    !ERROR: Argument of PRESENT() must be the name of a whole OPTIONAL dummy argument
17    print *, present(b%a)
18    !ERROR: Argument of PRESENT() must be the name of a whole OPTIONAL dummy argument
19    print *, present(a(1)%a)
20  end
21end
22