diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03')
-rw-r--r-- | gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03 new file mode 100644 index 000000000..02ca7fc4e --- /dev/null +++ b/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 |