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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [abstract_type_6.f03] - Blame information for rev 686

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do "compile" }
2
! Test the fix for PR43266, in which an ICE followed correct error messages.
3
!
4
! Contributed by Tobias Burnus 
5
! Reported in http://groups.google.ca/group/comp.lang.fortran/browse_thread/thread/f5ec99089ea72b79
6
!
7
!----------------
8
! library code
9
 
10
module m
11
TYPE, ABSTRACT :: top
12
CONTAINS
13
   PROCEDURE(xxx), DEFERRED :: proc_a ! { dg-error "must be a module procedure" }
14
   ! some useful default behaviour
15
   PROCEDURE :: proc_c => top_c ! { dg-error "must be a module procedure" }
16
END TYPE top
17
 
18
! Concrete middle class with useful behaviour
19
TYPE, EXTENDS(top) :: middle
20
CONTAINS
21
   ! do nothing, empty proc just to make middle concrete
22
   PROCEDURE :: proc_a => dummy_middle_a ! { dg-error "must be a module procedure" }
23
   ! some useful default behaviour
24
   PROCEDURE :: proc_b => middle_b ! { dg-error "must be a module procedure" }
25
END TYPE middle
26
 
27
!----------------
28
! client code
29
 
30
TYPE, EXTENDS(middle) :: bottom
31
CONTAINS
32
   ! useful proc to satisfy deferred procedure in top. Because we've
33
   ! extended middle we wouldn't get told off if we forgot this.
34
   PROCEDURE :: proc_a => bottom_a
35
   ! calls middle%proc_b and then provides extra behaviour
36
   PROCEDURE :: proc_b => bottom_b
37
   ! calls top_c and then provides extra behaviour
38
   PROCEDURE :: proc_c => bottom_c
39
END TYPE bottom
40
contains
41
SUBROUTINE bottom_b(obj)
42
   CLASS(Bottom) :: obj
43
   CALL obj%middle%proc_b ! { dg-error "should be a SUBROUTINE" }
44
   ! other stuff
45
END SUBROUTINE bottom_b
46
 
47
SUBROUTINE bottom_c(obj)
48
   CLASS(Bottom) :: obj
49
   CALL top_c(obj)
50
   ! other stuff
51
END SUBROUTINE bottom_c
52
end module
53
! { dg-final { cleanup-modules "m" } }

powered by: WebSVN 2.1.0

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