https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109846
Bug ID: 109846 Summary: [rejects valid] Pointer-valued function reference rejected as actual argument Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: neil.n.carlson at gmail dot com Target Milestone: --- Gfortran rejects the following example. module foo type :: parameter_list contains procedure :: sublist end type contains function sublist(this) result(slist) class(parameter_list), intent(inout) :: this class(parameter_list), pointer :: slist allocate(slist) end function end module program example use foo type(parameter_list) :: plist call sub(plist%sublist()) contains subroutine sub(plist) type(parameter_list), intent(inout) :: plist end subroutine end program With this error: 17 | call sub(plist%sublist()) | 1 Error: ‘sublist’ in variable definition context (actual argument to INTENT = OUT/INOUT) at (1) is not a variable It is accepted by both Intel OneAPI and NAG compilers. The sublist function returns a polymorphic pointer, which seems to be the source of the error. If it is modified to return a non-polymorphic pointer the example compiles without error. Alternatively, if the dummy argument intent is changed to intent(in) it also compiles without error. It is valid for a class(parameter_list) variable to be the actual argument for a type(parameter_list), intent(inout) dummy argument. So in light of 9.2/C902 (2018) I think this is a gfortran bug.