This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46328] [OOP] type-bound operator call with non-trivial polymorphic operand
- From: "damian at rouson dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 31 Oct 2011 02:06:36 +0000
- Subject: [Bug fortran/46328] [OOP] type-bound operator call with non-trivial polymorphic operand
- Auto-submitted: auto-generated
- References: <bug-46328-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46328
--- Comment #4 from Damian Rouson <damian at rouson dot net> 2011-10-31 02:06:36 UTC ---
Thanks for the update. The same error occurs when a defined assignment is
added:
$ cat abstract_field_expression.F90
module field_module
implicit none
type ,abstract :: field
contains
procedure(field_op_real) ,deferred :: multiply_real
procedure(field_eq_field) ,deferred :: assign
generic :: operator(*) => multiply_real
generic :: assignment(=) => assign
end type
abstract interface
function field_op_real(lhs,rhs)
import :: field
class(field) ,intent(in) :: lhs
real ,intent(in) :: rhs
class(field) ,allocatable :: field_op_real
end function
subroutine field_eq_field(lhs,rhs)
import :: field
class(field) ,intent(inout) :: lhs
class(field) ,intent(in) :: rhs
end subroutine
end interface
end module
program main
use field_module
implicit none
class(field) ,pointer :: u
u = (u)*2.
end program
$ gfortran abstract_field_expression.F90
abstract_field_expression.F90:29.6:
u = (u)*2.
1
Error: Operands of binary numeric operator '*' at (1) are CLASS(field)/REAL(4)
$ gfortran --version
GNU Fortran (GCC) 4.6.2 20111019 (prerelease)