Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / assign12.f90
blob30feb6b5b5b601e614e30830cbb1aa84bd74e6b4
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 module m
3 type base
4 procedure(baseSub), pointer :: baseComponent
5 end type
6 type, extends(base) :: extended
7 end type
8 contains
9 subroutine baseSub(x)
10 class(base), intent(in) :: x
11 end
12 subroutine extendedSub(x)
13 class(extended), intent(in) :: x
14 end
15 subroutine test
16 procedure(baseSub), pointer :: basePtr
17 procedure(extendedSub), pointer :: extendedPtr
18 type(extended) :: extendedVar
19 extendedPtr => baseSub ! ok
20 extendedPtr => basePtr ! ok
21 extendedVar = extended(baseSub) ! ok
22 extendedVar = extended(basePtr) ! ok
23 !ERROR: Procedure pointer 'baseptr' associated with incompatible procedure designator 'extendedsub': incompatible dummy argument #1: incompatible dummy data object types: CLASS(extended) vs CLASS(base)
24 basePtr => extendedSub
25 !ERROR: Procedure pointer 'baseptr' associated with incompatible procedure designator 'extendedptr': incompatible dummy argument #1: incompatible dummy data object types: CLASS(extended) vs CLASS(base)
26 basePtr => extendedPtr
27 !ERROR: Procedure pointer 'basecomponent' associated with incompatible procedure designator 'extendedsub': incompatible dummy argument #1: incompatible dummy data object types: CLASS(extended) vs CLASS(base)
28 extendedVar = extended(extendedSub)
29 !ERROR: Procedure pointer 'basecomponent' associated with incompatible procedure designator 'extendedptr': incompatible dummy argument #1: incompatible dummy data object types: CLASS(extended) vs CLASS(base)
30 extendedVar = extended(extendedPtr)
31 end
32 end