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/] [select_type_1.f03] - Blame information for rev 551

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

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do compile }
2
!
3
! Error checking for the SELECT TYPE statement
4
!
5
! Contributed by Janus Weil 
6
 
7
  type :: t1
8
    integer :: i = 42
9
    class(t1),pointer :: cp
10
  end type
11
 
12
  type, extends(t1) :: t2
13
    integer :: j = 99
14
  end type
15
 
16
  type :: t3
17
    real :: r
18
  end type
19
 
20
  type :: ts
21
    sequence
22
    integer :: k = 5
23
  end type
24
 
25
  class(t1), pointer :: a => NULL()
26
  type(t1), target :: b
27
  type(t2), target :: c
28
  a => b
29
  print *, a%i
30
 
31
  type is (t1)  ! { dg-error "Unexpected TYPE IS statement" }
32
 
33
  select type (3.5)  ! { dg-error "is not a named variable" }
34
  select type (a%cp) ! { dg-error "is not a named variable" }
35
  select type (b)    ! { dg-error "Selector shall be polymorphic" }
36
 
37
  select type (a)
38
    print *,"hello world!"  ! { dg-error "Expected TYPE IS, CLASS IS or END SELECT" }
39
  type is (t1)
40
    print *,"a is TYPE(t1)"
41
  type is (t2)
42
    print *,"a is TYPE(t2)"
43
  class is (ts)  ! { dg-error "must be extensible" }
44
    print *,"a is TYPE(ts)"
45
  type is (t3)   ! { dg-error "must be an extension of" }
46
    print *,"a is TYPE(t3)"
47
  type is (t4)   ! { dg-error "is not an accessible derived type" }
48
    print *,"a is TYPE(t3)"
49
  class is (t1)
50
    print *,"a is CLASS(t1)"
51
  class is (t2) label  ! { dg-error "Syntax error" }
52
    print *,"a is CLASS(t2)"
53
  class default  ! { dg-error "cannot be followed by a second DEFAULT CASE" }
54
    print *,"default"
55
  class default  ! { dg-error "cannot be followed by a second DEFAULT CASE" }
56
    print *,"default2"
57
  end select
58
 
59
label: select type (a)
60
  type is (t1) label
61
    print *,"a is TYPE(t1)"
62
  type is (t2)  ! { dg-error "overlaps with CASE label" }
63
    print *,"a is TYPE(t2)"
64
  type is (t2)  ! { dg-error "overlaps with CASE label" }
65
    print *,"a is still TYPE(t2)"
66
  class is (t1) labe   ! { dg-error "Expected block name" }
67
    print *,"a is CLASS(t1)"
68
  end select label
69
 
70
end

powered by: WebSVN 2.1.0

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