[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / call04.f90
blob6877f9c9fa939e540b764611514182160a9532a9
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test 8.5.10 & 8.5.18 constraints on dummy argument declarations
4 module m
6 type :: hasCoarray
7 real, allocatable :: a(:)[:]
8 end type
9 type, extends(hasCoarray) :: extendsHasCoarray
10 end type
11 type :: hasCoarray2
12 type(hasCoarray) :: x
13 end type
14 type, extends(hasCoarray2) :: extendsHasCoarray2
15 end type
17 real, allocatable :: coarray(:)[:]
19 contains
21 subroutine s01a(x)
22 real, allocatable, intent(out) :: x(:)
23 end subroutine
24 subroutine s01b ! C846 - can only be caught at a call via explicit interface
25 !ERROR: ALLOCATABLE coarray 'coarray' may not be associated with INTENT(OUT) dummy argument 'x='
26 !ERROR: ALLOCATABLE dummy argument 'x=' has corank 0 but actual argument has corank 1
27 call s01a(coarray)
28 end subroutine
30 subroutine s02(x) ! C846
31 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
32 type(hasCoarray), intent(out) :: x
33 end subroutine
35 subroutine s03(x) ! C846
36 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
37 type(extendsHasCoarray), intent(out) :: x
38 end subroutine
40 subroutine s04(x) ! C846
41 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
42 type(hasCoarray2), intent(out) :: x
43 end subroutine
45 subroutine s05(x) ! C846
46 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
47 type(extendsHasCoarray2), intent(out) :: x
48 end subroutine
50 end module
52 subroutine s06(x) ! C847
53 use ISO_FORTRAN_ENV, only: lock_type
54 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE
55 type(lock_type), intent(out) :: x
56 end subroutine
58 subroutine s07(x) ! C847
59 use ISO_FORTRAN_ENV, only: event_type
60 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE
61 type(event_type), intent(out) :: x
62 end subroutine