We are currently discussing the following new Fortran 2023 feature:
See this quote from Modern Fortran explained, Fortran 2023 edition, chapter 23.6.1, p.455-456:
“…, Fortran 2018 requires that a variableor componentthat is of a type with a coarray ultimate component be a non-pointer non-allocatable non-coarray scalar. Fortran 2023 permits such a variableor componentto be an array and/or allocatable, …This can happen at any depth of component selection,…”
I did interpret that this would allow a coding style as shown with the simple test case below:
program main
end program main
module test
implicit none
private
type, public :: a
private
integer, public, allocatable, dimension(:), codimension[:] :: coarray
end type a
type, public :: b
private
type(a), public, allocatable, dimension(:) :: channels_1 ! compile time error
! with ifx 2025.0.0:
! error #8474: A data component whose type has a coarray potential subobject
! component must be a nonpointer nonallocatable scalar.
end type b
type(a), public, allocatable, dimension(:) :: channels_2 ! compiles and runs
! perfectly with ifx 2025.0.0
end module test
But the compiler engineers do validly point to the Fortran 2023 standards text:
“C753 A data component whose type has a coarray potential subobject component shall be a nonpointer non-allocatable scalar and shall not be a coarray.”
Any idea what is wrong here? Did I mistake Modern Fortran explained? Or is there an error in the Fortran 2023 standard text, or is Modern Fortran explained wrong?