46 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! A CLASS() entity must be a dummy argument, allocatable,3! or object pointer. Don't get confused with procedure pointers.4module m5 type t6 end type7 !ERROR: CLASS entity 'v1' must be a dummy argument, allocatable, or object pointer8 class(t) v19 class(t), allocatable :: v2 ! ok10 class(t), pointer :: v3 ! ok11 !ERROR: CLASS entity 'p1' must be a dummy argument, allocatable, or object pointer12 procedure(cf1) :: p113 procedure(cf2) :: p214 procedure(cf3) :: p315 !ERROR: CLASS entity 'pp1' must be a dummy argument, allocatable, or object pointer16 procedure(cf1), pointer :: pp117 procedure(cf2), pointer :: pp218 procedure(cf3), pointer :: pp319 procedure(cf5), pointer :: pp4 ! ok20 contains21 !ERROR: CLASS entity 'cf1' must be a dummy argument, allocatable, or object pointer22 class(t) function cf1()23 end24 class(t) function cf2()25 allocatable cf2 ! ok26 end27 class(t) function cf3()28 pointer cf3 ! ok29 end30 subroutine test(d1,d2,d3)31 class(t) d1 ! ok32 !ERROR: CLASS entity 'd2' must be a dummy argument, allocatable, or object pointer33 class(t), external :: d234 !ERROR: CLASS entity 'd3' must be a dummy argument, allocatable, or object pointer35 class(t), external, pointer :: d336 end37 function cf4()38 class(t), pointer :: cf439 cf4 => v340 end41 function cf542 procedure(cf4), pointer :: cf543 cf5 => cf444 end45end46