OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [move_alloc_9.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
!
3
! Test diagnostic for MOVE_ALLOC:
4
! FROM=type, TO=class is OK
5
! FROM=class, TO=type is INVALID
6
!
7
module m2
8
  type, abstract :: t2
9
  contains
10
    procedure(intf), deferred, nopass :: f
11
  end type t2
12
 
13
  interface
14
    function intf()
15
      import
16
      class(t2), allocatable :: intf
17
    end function intf
18
  end interface
19
end module m2
20
 
21
module m3
22
  use m2
23
  type, extends(t2) :: t3
24
  contains
25
    procedure,nopass :: f => my_f
26
  end type t3
27
contains
28
   function my_f()
29
     class(t2), allocatable :: my_f
30
   end function my_f
31
end module m3
32
 
33
subroutine my_test
34
use m3
35
type(t3), allocatable :: x
36
class(t2), allocatable :: y
37
call move_alloc (x, y)
38
end subroutine my_test
39
 
40
program testmv1
41
  type bar
42
  end type
43
 
44
  type, extends(bar) ::  bar2
45
  end type
46
 
47
  class(bar), allocatable :: sm
48
  type(bar2), allocatable :: sm2
49
 
50
  allocate (sm2)
51
  call move_alloc (sm,sm2) ! { dg-error "must be polymorphic if FROM is polymorphic" }
52
 
53
  if (allocated(sm2)) call abort()
54
  if (.not. allocated(sm)) call abort()
55
end program
56
 
57
! { dg-final { cleanup-modules "m2 m3" } }

powered by: WebSVN 2.1.0

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