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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [select_type_10.f03] - Blame information for rev 302

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do compile }
2
!
3
! PR 42167: [OOP] SELECT TYPE with function return value
4
!
5
! Contributed by Damian Rouson 
6
 
7
module bar_module
8
 
9
  implicit none
10
  type :: bar
11
    real ,dimension(:) ,allocatable :: f
12
  contains
13
    procedure :: total
14
  end type
15
 
16
contains
17
 
18
  function total(lhs,rhs)
19
    class(bar) ,intent(in) :: lhs
20
    class(bar) ,intent(in) :: rhs
21
    class(bar) ,pointer :: total
22
    select type(rhs)
23
      type is (bar)
24
        allocate(bar :: total)
25
        select type(total)
26
          type is (bar)
27
            total%f = lhs%f + rhs%f
28
        end select
29
    end select
30
  end function
31
 
32
end module
33
 
34
! { 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.