https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125530
Bug ID: 125530
Summary: ASSOCIATE with contained-function selector rejects
type-bound calls on associate name
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jvdelisle at gcc dot gnu.org
Target Milestone: ---
gfortran rejects type-bound procedure calls on an ASSOCIATE name when the
selector is a call to a contained function. Two error patterns are observed
depending on whether the type-bound call is direct or generic:
1. Direct type-bound call gives:
"VARIABLE attribute conflicts with PROCEDURE attribute"
2. Generic type-bound call gives:
"'x' has no IMPLICIT type"
module m
implicit none
type :: t
integer :: n = 0
contains
procedure :: direct_call
procedure :: target_of_generic
generic :: generic_call => target_of_generic
end type
contains
subroutine direct_call (self)
class(t), intent(in) :: self
print *, self%n
end subroutine
subroutine target_of_generic (self)
class(t), intent(in) :: self
print *, self%n
end subroutine
end module
subroutine test_direct ()
use m
implicit none
associate (x => make_t ())
call x%direct_call ()
end associate
contains
function make_t () result (r)
type(t) :: r
r%n = 1
end function
end subroutine
subroutine test_generic ()
use m
implicit none
associate (x => make_t ())
call x%generic_call ()
end associate
contains
function make_t () result (r)
type(t) :: r
r%n = 2
end function
end subroutine
$ gfortran associate_contained_func_typebound.f90
gfortran rejects both subroutines. Both should compile
cleanly.