summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f9018
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f90
new file mode 100644
index 000000000..d0e57aea5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! Check that ALLOCATABLE components aren't allowed to the right of a non-zero
+! rank part reference.
+program test
+
+ implicit none
+ type :: foo
+ real, allocatable :: bar(:)
+ end type foo
+ type(foo), target :: x(3)
+ integer :: i
+ real, pointer :: p(:)
+
+ allocate(x(:)%bar(5))! { dg-error "must not have the ALLOCATABLE attribute" }
+ x(:)%bar(1) = 1.0 ! { dg-error "must not have the ALLOCATABLE attribute" }
+ p => x(:)%bar(1) ! { dg-error "must not have the ALLOCATABLE attribute" }
+
+end program test