https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123352
Bug ID: 123352
Summary: invalid association target when invoking type-bound
function on associate-name with operator-result
selector
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: damian at archaeologic dot codes
Target Milestone: ---
$ cat reproducer.f90
module tensors_m
implicit none
type foo_t
contains
generic :: operator(.op.) => op
procedure op
procedure f
end type
contains
type(foo_t) function op(self)
class(foo_t), intent(in) :: self
op = self
end function
integer function f(self)
class(foo_t) self
f = 0
end function
end module
use tensors_m
implicit none
type(foo_t) foo
associate(op_foo => .op. foo)
associate(op_foo_f => op_foo%f())
end associate
end associate
end
$ gfortran reproducer.f90
reproducer.f90:30:26:
30 | associate(op_foo_f => op_foo%f())
| 1
Error: Invalid association target at (1)
reproducer.f90:32:5:
32 | end associate
| 1
Error: Expecting END PROGRAM statement at (1)
$ gfortran --version
GNU Fortran (GCC) 16.0.0 20251213 (experimental)