https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102190
Bug ID: 102190 Summary: Syntax error reported in associate construct Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: everythingfunctional at protonmail dot com Target Milestone: --- I think this is related to 102109 and 102112, because minor changes can illicit the errors reported in those. Given: module sub_m type :: sub_t private integer :: val end type interface sub_t module procedure constructor end interface contains function constructor(val) result(sub) integer, intent(in) :: val type(sub_t) :: sub sub%val = val end function end module module obj_m use sub_m, only: sub_t type :: obj_t private type(sub_t) :: sub_obj_ contains procedure :: sub_obj end type interface obj_t module procedure constructor end interface contains function constructor(sub_obj) result(obj) type(sub_t), intent(in) :: sub_obj type(obj_t) :: obj obj%sub_obj_ = sub_obj end function function sub_obj(self) class(obj_t), intent(in) :: self type(sub_t) :: sub_obj sub_obj = self%sub_obj_ end function end module program main use sub_m, only: sub_t use obj_m, only: obj_t associate(initial_sub => sub_t(42)) associate(obj => obj_t(initial_sub)) associate(sub_obj => obj%sub_obj()) end associate end associate end associate end program I get the error: combined.f90:51:38: 51 | associate(sub_obj => obj%sub_obj()) | 1 Error: Expected ‘)’ or ‘,’ at (1) But if you add implicit none to the program, you get the error reported in 102112, and if you make the components of the types public and/or define the types in the main program, you get the error reported in 102109.