https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93422

--- Comment #1 from Andrew Benson <abensonca at gmail dot com> ---
Using a "result()" for the return value of the function allows this to compile
successfully:

module t

  type :: a
   contains
     procedure :: p => ap
  end type a

  type, extends(a) :: b
   contains
     procedure :: p => bp
  end type b

  type :: c
  end type c

  type, extends(c) :: d
  end type d

  interface
     module function bp(s) result(ss)
       class(b), intent(inout) :: s
       class(d), pointer :: ss
     end function
  end interface

contains

  function ap(s) result(ss)
    class(d), pointer :: ss
    class(a), intent(inout) :: s
  end function ap

end module t

submodule (t) ts

contains

  function bp(s) result(ss)
    class(d), pointer :: ss
    class(b), intent(inout) :: s
  end function bp

end submodule ts

Reply via email to