https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119994
--- Comment #1 from Neil Carlson <neil.n.carlson at gmail dot com> ---
Here's a similar example using an internal subroutine. The rejected
specification expression is also valid, as again THIS is accessible by host
association.
module foo
type :: bar
integer :: n
end type
contains
subroutine init(this, n)
type(bar), intent(out) :: this
integer, intent(in) :: n
this%n = n
call sub
contains
subroutine sub
real :: array(this%n)
end subroutine
end subroutine
end module