https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61275

--- Comment #5 from vehre at gcc dot gnu.org ---
Completely right, the initial test is still not compilable. But this is because
assigning to an allocatable component in an initializer is not allowed by the
standards:
F2003, 7.1.7 (3) and also in
F2008, 7.1.12 (3).

So the correct code would be:

module A

    Type T
    character(LEN=:), allocatable :: S
    end type
    Type(T) :: TestObj = T(NULL())

    TestObj%S = 'string'

    contains

    end module

which compiles and runs w/o error.
Standard compliant implementation is tested for in 

gfortran.dg/alloc_comp_init_expr.f03

only far allocatable arrays, but that's near enough for char arrays for me.

Reply via email to