http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47463
--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-31 21:42:29 UTC --- (In reply to comment #6) > > And the same without type-binding: > > call init_comps(this, st, gr) > > Error: Type mismatch in argument 'this' at (1); passed CLASS(flow_t) to > > CLASS(grid_t) I looked closer at that version. a) It works if one reverses the order of subroutines (all versions) Rich: That's a work around, which is sufficient to compile the whole program. Note: You need a gfortran, which includes Janus' patch from comment 8. b) For the failing version. The formal argument in compare_actual_formal alias compare_parameter is odd: (gdb) p a->expr->ts.u.derived->name $17 = 0x2aaaacf0eae0 "__class_hydro_flow_Flow_t" (gdb) p f->sym->ts.u.derived->name $18 = 0x2aaaacf0eac0 "__class_hydro_grid_Grid_t_a" (gdb) p f->sym->name $19 = 0x2aaaace40fb0 "this" Namely, the formal argument has the right name, but it is associated with the wrong typespec! * * * Reduced test case: module hydro_grid type :: grid_t contains procedure :: assign generic :: assignment(=) => assign end type grid_t public :: grid_t contains subroutine assign (this, that) class(grid_t), intent(inout) :: this class(grid_t), intent(in) :: that end subroutine assign end module hydro_grid module hydro_flow use hydro_grid type :: flow_t class(grid_t), allocatable :: gr ! Computation grid end type flow_t contains subroutine init_params (this) class(flow_t), intent(out) :: this type(grid_t) :: gr call init_comps(this, gr) end subroutine init_params subroutine init_comps (this, gr) class(flow_t), intent(out) :: this class(grid_t), intent(in) :: gr this%gr = gr end subroutine init_comps end module hydro_flow