| 1 |
! PR fortran/97768 |
| 2 |
! { dg-do compile } |
| 3 |
|
| 4 |
module pr97768_2 |
| 5 |
interface operator(.in.) |
| 6 |
module procedure substr_in_str |
| 7 |
end interface |
| 8 |
contains |
| 9 |
pure function to_upper (in_str) result (string) |
| 10 |
character(len=*), intent(in) :: in_str |
| 11 |
character(len=len(in_str)) :: string |
| 12 |
string = in_str |
| 13 |
end function to_upper |
| 14 |
logical pure function substr_in_str (substring, string) |
| 15 |
character(len=*), intent(in) :: string, substring |
| 16 |
substr_in_str=.false. |
| 17 |
end function |
| 18 |
end module |
| 19 |
function foo () |
| 20 |
use pr97768_2, only : to_upper, operator(.in.) |
| 21 |
logical :: foo |
| 22 |
character(len=8) :: str |
| 23 |
str = 'abcde' |
| 24 |
foo = to_upper (str) .in. 32 ! { dg-error "are CHARACTER/INTEGER" } |
| 25 |
end function foo |
| 26 |
function bar (str) |
| 27 |
use pr97768_2, only : operator(.in.) |
| 28 |
logical :: bar |
| 29 |
character(len=*) :: str |
| 30 |
foo = str .in. 32 ! { dg-error "are CHARACTER\\(\\*\\)/INTEGER" } |
| 31 |
end function bar |
| 32 |
function baz (lenstr) |
| 33 |
use pr97768_2, only : operator(.in.) |
| 34 |
logical :: baz |
| 35 |
integer :: lenstr |
| 36 |
character(len=lenstr) :: str |
| 37 |
str = 'abc' |
| 38 |
foo = str .in. 32 ! { dg-error "are CHARACTER/INTEGER" } |
| 39 |
end function baz |
| 40 |
function qux () |
| 41 |
use pr97768_2, only : operator(.in.) |
| 42 |
logical :: qux |
| 43 |
character(len=8) :: str |
| 44 |
str = 'def' |
| 45 |
foo = str .in. 32 ! { dg-error "are CHARACTER\\(8\\)/INTEGER" } |
| 46 |
end function qux |
| 47 |
function corge () |
| 48 |
use pr97768_2, only : operator(.in.) |
| 49 |
logical :: corge |
| 50 |
character(len=:), allocatable :: str |
| 51 |
str = 'ghijk' |
| 52 |
foo = str .in. 32 ! { dg-error "are CHARACTER\\(:\\)/INTEGER" } |
| 53 |
end function corge |