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: Wed, 10 Aug 2011 04:46:08 +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
Damian Rouson <damian at rouson dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |damian at rouson dot net
--- Comment #2 from Damian Rouson <damian at rouson dot net> 2011-08-10 04:46:08 UTC ---
i think the code below is another example of this bug. Any chance this will be
resolved in 4.7? (The NAG Fortran and IBM XL Fortran compilers compile the
code without error):
$ cat integrand.F90
module foo_module
type ,abstract :: foo
contains
procedure(t_interface) ,deferred :: t
procedure(assign_interface) ,deferred :: assign
procedure(multiply_interface) ,deferred :: multiply
generic :: operator(*) => multiply
generic :: assignment(=) => assign
end type
abstract interface
function t_interface(this)
import :: foo
class(foo) :: this
class(foo), allocatable ::t_interface
end function
function multiply_interface(lhs,rhs)
import :: foo
class(foo), allocatable :: multiply_interface
class(foo), intent(in) :: lhs
real, intent(in) :: rhs
end function
subroutine assign_interface(lhs,rhs)
import :: foo
class(foo), intent(in) :: rhs
class(foo), intent(inout) :: lhs
end subroutine
end interface
contains
subroutine bar(x,dt)
class(foo) :: x
real, intent(in) :: dt
x = x%t()*dt
end subroutine
end module
$ gfortran -c integrand.F90
integrand.F90:32.8:
x = x%t()*dt
1
Error: Operands of binary numeric operator '*' at (1) are CLASS(foo)/REAL(4)
$ gfortran --version
GNU Fortran (GCC) 4.6.1 20110325 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING