messages_.Say(
"An assumed-length CHARACTER(*) function cannot return a POINTER"_err_en_US);
}
+ } else if (IsPointer(symbol)) {
+ messages_.Say(
+ "A procedure pointer should not have assumed-length CHARACTER(*) result type"_port_en_US);
}
}
if (symbol.attrs().test(Attr::VALUE)) {
end function
subroutine s01(f1, f2, fp1, fp2)
+ !PORTABILITY: A procedure pointer should not have assumed-length CHARACTER(*) result type
character*(*) :: f1, f3, fp1
external :: f1, f3
pointer :: fp1
+ !PORTABILITY: A procedure pointer should not have assumed-length CHARACTER(*) result type
procedure(character*(*)), pointer :: fp2
interface
character*(*) function f2()
--- /dev/null
+! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
+! Confirm enforcement of constraint C723 in F2018 for procedure pointers
+
+ module m
+ contains
+ subroutine subr(parg)
+ !PORTABILITY: A procedure pointer should not have assumed-length CHARACTER(*) result type
+ procedure(character(*)), pointer :: parg
+ !PORTABILITY: A procedure pointer should not have assumed-length CHARACTER(*) result type
+ procedure(character(*)), pointer :: plocal
+ print *, parg()
+ plocal => parg
+ call subr_1(plocal)
+ end subroutine
+
+ subroutine subr_1(parg_1)
+ !PORTABILITY: A procedure pointer should not have assumed-length CHARACTER(*) result type
+ procedure(character(*)), pointer :: parg_1
+ print *, parg_1()
+ end subroutine
+ end module
+
+ character(*) function f()
+ f = 'abcdefgh'
+ end function
+
+ program test
+ use m
+ character(4), external :: f
+ procedure(character(4)), pointer :: p
+ p => f
+ call subr(p)
+ end
+