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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [defined_operators_1.f90] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do compile }
2
! { dg-options "-std=legacy" }
3
! Tests the fix for PR27122, in which the requirements of 12.3.2.1.1
4
! for defined operators were not enforced.
5
!
6
! Based on PR test by Thomas Koenig  
7
!
8
module mymod
9
  interface operator (.foo.)
10
     module procedure foo_0 ! { dg-error "must have at least one argument" }
11
     module procedure foo_1 ! { dg-error "must be INTENT" }
12
     module procedure foo_2 ! { dg-error "cannot be optional" }
13
     module procedure foo_3 ! { dg-error "must have, at most, two arguments" }
14
     module procedure foo_1_OK  ! { dg-error "Ambiguous interfaces" }
15
     module procedure foo_2_OK
16
     function foo_chr (chr) ! { dg-error "cannot be assumed character length" }
17
       character(*) :: foo_chr
18
       character(*), intent(in) :: chr
19
     end function foo_chr
20
     subroutine bad_foo (chr) ! { dg-error "must be a FUNCTION" }
21
       character(*), intent(in) :: chr
22
     end subroutine bad_foo
23
  end interface
24
contains
25
  function foo_0 ()
26
    integer :: foo_1
27
    foo_0 = 1
28
  end function foo_0
29
  function foo_1 (a)
30
    integer :: foo_1
31
    integer :: a
32
    foo_1 = 1
33
  end function foo_1
34
  function foo_1_OK (a)
35
    integer :: foo_1_OK
36
    integer, intent (in) :: a
37
    foo_1_OK = 1
38
  end function foo_1_OK
39
  function foo_2 (a, b)
40
    integer :: foo_2
41
    integer, intent(in) :: a
42
    integer, intent(in), optional :: b
43
    foo_2 = 2 * a + b
44
  end function foo_2
45
  function foo_2_OK (a, b)
46
    real :: foo_2_OK
47
    real, intent(in) :: a
48
    real, intent(in) :: b
49
    foo_2_OK = 2.0 * a + b
50
  end function foo_2_OK
51
  function foo_3 (a, b, c)
52
    integer :: foo_3
53
    integer, intent(in) :: a, b, c
54
    foo_3 = a + 3 * b - c
55
  end function foo_3
56
end module mymod
57
! { dg-final { cleanup-modules "mymod" } }

powered by: WebSVN 2.1.0

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