gcc/testsuite/gfortran.dg/alloc_comp_init_expr.f03
raw| 1 | ! { dg-do compile } |
| 2 | ! PR fortran/34402 - allocatable components shall not be |
| 3 | ! data-initialized in init expr |
| 4 | |
| 5 | type t |
| 6 | real, allocatable :: x(:) |
| 7 | end type |
| 8 | |
| 9 | ! The following is illegal! |
| 10 | type (t) :: bad = t ( (/ 1., 3., 5., 7., 9. /) ) ! { dg-error "Invalid initialization expression" } |
| 11 | |
| 12 | ! This is ok |
| 13 | type (t) :: ok = t ( NULL() ) |
| 14 | end |