http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54832
Bug #: 54832
Summary: [4.8 Regression] [OOP] Type-bound operator not picked
up with RESULT variable
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Reported by Damian Rouson at:
http://gcc.gnu.org/ml/fortran/2012-10/msg00032.html
Test case:
module integrand_module
type ,abstract :: integrand
contains
procedure(t_interface), deferred :: t
procedure(assign_interface), deferred :: assign
procedure(times_interface), deferred :: times
generic :: operator(*) => times
generic :: assignment(=) => assign
end type
abstract interface
function t_interface(this) result(dState_dt)
import :: integrand
class(integrand) ,intent(in) :: this
class(integrand) ,allocatable :: dState_dt
end function
function times_interface(lhs,rhs)
import :: integrand
class(integrand) ,intent(in) :: lhs
class(integrand) ,allocatable :: times_interface
real, intent(in) :: rhs
end function
subroutine assign_interface(lhs,rhs)
import :: integrand
class(integrand) ,intent(in) :: rhs
class(integrand) ,intent(inout) :: lhs
end subroutine
end interface
contains
subroutine integrate(model,dt)
class(integrand) :: model
real dt
model = model%t()*dt
end subroutine
end module
While 4.7 compiles it cleanly, 4.8 gives:
model = model%t()*dt
1
Error: Operands of binary numeric operator '*' at (1) are
CLASS(integrand)/REAL(4)