gfortran - How to initialize fortran derived type parameter variable containing an allocatable array? -
this compiles correctly:
type t1 integer :: a, b(2), c end type t1 type(t1), parameter :: t1a = t1(1, [2, 3], 4) i want write this, except doesn't compile:
type t2 integer :: integer, allocatable :: b(:) integer :: c end type t2 type(t2), parameter :: t2a = t2(1, [2, 3], 4) ! compile error type(t2), parameter :: t2b = t2(1, [2, 3, 4], 5) ! compile error the gfortran error messages error: invalid initialization expression allocatable component 'b' in structure constructor doesn't give me clue correct syntax.
i don't complaint trying declare parameter variable allocatable type, assume there must some way initialize it!
i think assume wrong. 2008 standard explicitly forbids initialisation of allocatable entity (r503/c506) , suspect forbids initialisation of allocatable entity component of derived type though can't find chapter , verse support suspicion.
Comments
Post a Comment