1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
3 ! Error tests for structure constructors of derived types with allocatable components
7 integer, allocatable
:: pa
10 real, allocatable
:: pa(:)
21 integer, pointer :: ipp
22 real, pointer :: rpp(:)
23 !ERROR: Must be a constant value
24 type(parent1
) :: tp1
= parent1(3)
25 !ERROR: Must be a constant value
26 type(parent1
) :: tp2
= parent1(j
)
27 type(parent1
) :: tp3
= parent1(null())
28 !PORTABILITY: NULL() with arguments is not standard conforming as the value for allocatable component 'pa'
29 type(parent1
) :: tp4
= parent1(null(ipp
))
31 !ERROR: Must be a constant value
32 type(parent2
) :: tp5
= parent2([1.1,2.1,3.1])
33 !ERROR: Must be a constant value
34 type(parent2
) :: tp6
= parent2(arr
)
35 type(parent2
) :: tp7
= parent2(null())
36 !PORTABILITY: NULL() with arguments is not standard conforming as the value for allocatable component 'pa'
37 type(parent2
) :: tp8
= parent2(null(rpp
))
43 integer, pointer :: ipp
44 real, pointer :: rpp(:)
50 !PORTABILITY: NULL() with arguments is not standard conforming as the value for allocatable component 'pa'
51 tp1
= parent1(null(ipp
))
53 tp2
= parent2([1.1,2.1,3.1])
56 !PORTABILITY: NULL() with arguments is not standard conforming as the value for allocatable component 'pa'
57 tp2
= parent2(null(rpp
))
61 real, pointer :: pp(:)
62 type(child
) :: tc1
= child(5, parent2(null()))
63 !PORTABILITY: NULL() with arguments is not standard conforming as the value for allocatable component 'pa'
64 type(child
) :: tc10
= child(5, parent2(null(pp
)))
65 !ERROR: Must be a constant value
66 type(child
) :: tc3
= child(5, parent2([1.1,1.2]))
69 tc4
= child(5, parent2(null()))
70 tc4
= child(5, parent2([1.1,1.2]))