Issue 81786
Summary [flang] function reference passed to extends_type_of intrinsic is not called
Labels bug, flang:frontend
Assignees
Reporter kkwli
    Reproducer
```fortran
module m
  type Base
    integer i
  contains
    final :: finalizeBase
  end type
  type, extends(Base) :: Child
 contains
    final :: finalizeChild
  end type

contains
 subroutine finalizeBase(b)
    type(Base), intent(inout) :: b
    print *, "finalizeBase"
  end subroutine
  subroutine finalizeChild(c)
 type(Child), intent(inout) :: c
    print *, "finalizeChild"
  end subroutine
  function func1()
    class(Base), allocatable :: func1
 allocate(Base::func1)
    print*, 'func1 ...'
  end function
end module

program main
  use m
  type(Base) :: arg1
  logical :: l
  l = extends_type_of(func1(), arg1)
end 
```

The expected output is `func1` is called as well as `finalizeBase` due to finalization of the function result.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to