You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.