This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/46328] [OOP] type-bound operator call with non-trivial polymorphic operand


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]