With the following code
module m_1
implicit none
type t_1
integer i
contains
procedure, private :: t1_ass_i
generic :: assignment(=) => t1_ass_i
end type
contains
elemental subroutine t1_ass_i( var, expr )
class(t_1), intent(out) :: var
integer, intent(in) :: expr
var%i = expr
end subroutine
end module
module m2
use m_1
implicit none
type :: T_2
LOGICAL :: a_flag
end type
type:: T_3
type(t_1) :: a_date
end type
type :: T_4
end type
type, public:: T_5
type(T_2) :: v_t2
type(T_3) :: v_t3
type(T_4) :: v_t4
end type
end module
program test
use m2
implicit none
type(T_5) :: a1, a2
a1%v_t2%a_flag = .true.
a2 = a1
print *, a1%v_t2%a_flag
print *, a2%v_t2%a_flag
end program test
the result I expect is:
T T
but we get:
T F
the fact that commenting the line
type(T_4) :: v_t4
leads to the expected result makes me think this is a compiler bug, but I am not 100% of my interpretation of the standard re components with defined assignment.
I am currently using ifort v17.0.4.210 Build 20170411