1! { dg-do compile }
2program p
3   type t
4      integer :: n = 0
5      integer, pointer :: q => null()
6   end type
7   type(t) :: x
8   print *, associated(x%q)
9   x = f()
10   print *, associated(x%q)
11contains
12   function f() result (z)    ! { dg-error "must be dummy, allocatable or pointer" }
13      class(t) :: z
14      print *, associated(z%q)
15   end
16end
17