https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117070
--- Comment #5 from anlauf at gcc dot gnu.org --- (In reply to Ivan Pribec from comment #4) > Steve reckons the example is valid, see: > https://community.intel.com/t5/Intel-Fortran-Compiler/Procedure-target-in- > structure-constructor/m-p/1681101#M175473 While I still have my doubts on the use of the constructor with a named constant, I agree that the following reduced code should compile: module funcs implicit none abstract interface function retchar() character(len=1) :: retchar end function retchar end interface contains function a() character(len=1) :: a a = 'a' end function end module module dispatch_table use funcs implicit none ! Procedure container type :: pc procedure(retchar), pointer, nopass :: rc => null() end type pc type(pc) :: myfun = pc(rc=a) end module Indeed, "7.5.10 Construction of derived‐type values" has: ! For a pointer component, the corresponding component‐data‐source shall be ! an allowable data‐target or proc‐target for such a pointer in a pointer ! assignment statement (10.2.2). If the component data source is a pointer, ! the association of the component is that of the pointer; otherwise, the ! component is pointer associated with the component data source. But the above is rejected with: pr117070-1.f90:25:28: 25 | type(pc) :: myfun = pc(rc=a) | 1 Error: Parameter 'a' at (1) has not been declared or is a variable, which does not reduce to a constant expression Intel ifx 2025.3 gives a similar error.
