aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr97768_2.f90
blob: 5dc198720b6330d7eb048d8958b843d3c4e6ac01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
! PR fortran/97768
! { dg-do compile }

module pr97768_2
  interface operator(.in.)
    module procedure substr_in_str
  end interface
contains
  pure function to_upper (in_str) result (string)
    character(len=*), intent(in) :: in_str
    character(len=len(in_str)) :: string
    string = in_str
  end function to_upper
  logical pure function substr_in_str (substring, string)
    character(len=*), intent(in) :: string, substring
    substr_in_str=.false.
  end function
end module
function foo ()
  use pr97768_2, only : to_upper, operator(.in.)
  logical :: foo
  character(len=8) :: str
  str = 'abcde'
  foo = to_upper (str) .in. 32    ! { dg-error "are CHARACTER/INTEGER" }
end function foo
function bar (str)
  use pr97768_2, only : operator(.in.)
  logical :: bar
  character(len=*) :: str
  foo = str .in. 32               ! { dg-error "are CHARACTER\\(\\*\\)/INTEGER" }
end function bar
function baz (lenstr)
  use pr97768_2, only : operator(.in.)
  logical :: baz
  integer :: lenstr
  character(len=lenstr) :: str
  str = 'abc'
  foo = str .in. 32               ! { dg-error "are CHARACTER/INTEGER" }
end function baz
function qux ()
  use pr97768_2, only : operator(.in.)
  logical :: qux
  character(len=8) :: str
  str = 'def'
  foo = str .in. 32               ! { dg-error "are CHARACTER\\(8\\)/INTEGER" }
end function qux
function corge ()
  use pr97768_2, only : operator(.in.)
  logical :: corge
  character(len=:), allocatable :: str
  str = 'ghijk'
  foo = str .in. 32               ! { dg-error "are CHARACTER\\(:\\)/INTEGER" }
end function corge