Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / alloc_comp_constraint_5.f90
blobd0e57aea593e4695a768596b5ad2435ccc0e3059
1 ! { dg-do compile }
2 ! Check that ALLOCATABLE components aren't allowed to the right of a non-zero
3 ! rank part reference.
4 program test
6 implicit none
7 type :: foo
8 real, allocatable :: bar(:)
9 end type foo
10 type(foo), target :: x(3)
11 integer :: i
12 real, pointer :: p(:)
14 allocate(x(:)%bar(5))! { dg-error "must not have the ALLOCATABLE attribute" }
15 x(:)%bar(1) = 1.0 ! { dg-error "must not have the ALLOCATABLE attribute" }
16 p => x(:)%bar(1) ! { dg-error "must not have the ALLOCATABLE attribute" }
18 end program test