Consider the following test case
use, intrinsic :: iso_c_binding
type dt
type(c_ptr) :: a(5)
end type
integer, target :: k
type(dt) :: x
x = dt(c_loc(k))
end
Flang currently issues an error as:
./t.f:7:8: error: Scalar value cannot be expanded to shape of array component 'a'
x = dt(c_loc(k))
^^^^^^^^
./t.f:3:16: Declaration of 'a'
type(c_ptr) :: a(5)
^
It compiles the code fine if the type of a is intrinsic type as well as the corresponding argument to the structure constructor.
XLF, ifort and gfortran all accept the above code.