https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91978
Bug ID: 91978 Summary: Unresolved associate target containing defined operation Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: pault at gcc dot gnu.org Target Milestone: --- Noted by "FortranFan" on https://groups.google.com/forum/#!topic/comp.lang.fortran/EtGmIRqvF2E module my_type_old implicit none type :: my_type real :: r = 1.0 contains procedure, pass(lhs) :: sum_my_types procedure, pass(this), public :: output => output_my_types generic, public :: operator(+) => sum_my_types end type my_type contains function sum_my_types (lhs, rhs) result (t_sum) class(my_type), intent(in) :: lhs type(my_type), intent(in) :: rhs type(my_type) :: t_sum t_sum%r = lhs%r + rhs%r return end function sum_my_types subroutine output_my_types( this ) class(my_type), intent(in) :: this print *, "t%r = ", this%r end subroutine end module my_type_old program p blk7: block use my_type_old, only : my_type type(my_type) :: foo, bar print *, "Block 7" associate ( foobar => foo + bar) !<-- not supported by gfortran call foobar%output() print *, "Expected is r = 2.0" end associate end block blk7 blk8: block use my_type_old, only : my_type type(my_type) :: foo, bar print *, "Block 8" associate ( foobar => foo%sum_my_types(bar)) ! This is OK call foobar%output() print *, "Expected is r = 2.0" end associate end block blk8 end program [pault@pc30 pr91926]$ ~/irun9/bin/gfortran -static-libgfortran -fdump-tree-original ../fortranfan.f90 ../fortranfan.f90:30:20: 30 | call foobar%output() | 1 Error: VARIABLE attribute of ‘foobar’ conflicts with PROCEDURE attribute at (1) The reason that I used 9-branch is that I have a partial fix on trunk :-) The TKR of 'foobar' is not being determined by the parsing of the ASSOCIATE statement in blk7. Paul