aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f0314
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03 b/gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03
new file mode 100644
index 000000000..02ca7fc4e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! PR fortran/34402 - allocatable components shall not be
+! data-initialized in init expr
+
+ type t
+ real, allocatable :: x(:)
+ end type
+
+ ! The following is illegal!
+ type (t) :: bad = t ( (/ 1., 3., 5., 7., 9. /) ) ! { dg-error "Invalid initialization expression" }
+
+ ! This is ok
+ type (t) :: ok = t ( NULL() )
+end