OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [select_type_10.f03] - Diff between revs 302 and 384

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 302 Rev 384
! { dg-do compile }
! { dg-do compile }
!
!
! PR 42167: [OOP] SELECT TYPE with function return value
! PR 42167: [OOP] SELECT TYPE with function return value
!
!
! Contributed by Damian Rouson 
! Contributed by Damian Rouson 
module bar_module
module bar_module
  implicit none
  implicit none
  type :: bar
  type :: bar
    real ,dimension(:) ,allocatable :: f
    real ,dimension(:) ,allocatable :: f
  contains
  contains
    procedure :: total
    procedure :: total
  end type
  end type
contains
contains
  function total(lhs,rhs)
  function total(lhs,rhs)
    class(bar) ,intent(in) :: lhs
    class(bar) ,intent(in) :: lhs
    class(bar) ,intent(in) :: rhs
    class(bar) ,intent(in) :: rhs
    class(bar) ,pointer :: total
    class(bar) ,pointer :: total
    select type(rhs)
    select type(rhs)
      type is (bar)
      type is (bar)
        allocate(bar :: total)
        allocate(bar :: total)
        select type(total)
        select type(total)
          type is (bar)
          type is (bar)
            total%f = lhs%f + rhs%f
            total%f = lhs%f + rhs%f
        end select
        end select
    end select
    end select
  end function
  end function
end module
end module
! { dg-final { cleanup-modules "bar_module" } }
! { dg-final { cleanup-modules "bar_module" } }
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.