| 1 |
! { dg-do compile } |
| 2 |
! Tests fix for PR26107 in which an ICE would occur after the second |
| 3 |
! error message below. This resulted from a spurious attempt to |
| 4 |
! produce the third error message, without the name of the function. |
| 5 |
! |
| 6 |
! This is an expanded version of the testcase in the PR. |
| 7 |
! |
| 8 |
pure function equals(self, & ! { dg-error "must be INTENT" } |
| 9 |
string, ignore_case) result(same) |
| 10 |
character(*), intent(in) :: string |
| 11 |
integer(4), intent(in) :: ignore_case |
| 12 |
integer(4) :: same |
| 13 |
if (len (self) < 1) return ! { dg-error "must be CHARACTER" } |
| 14 |
same = 1 |
| 15 |
end function |
| 16 |
|
| 17 |
function impure(self) result(ival) |
| 18 |
character(*), intent(in) :: self |
| 19 |
ival = 1 |
| 20 |
end function |
| 21 |
|
| 22 |
pure function purity(self, string, ignore_case) result(same) |
| 23 |
character(*), intent(in) :: self |
| 24 |
character(*), intent(in) :: string |
| 25 |
integer(4), intent(in) :: ignore_case |
| 26 |
integer i |
| 27 |
if (end > impure (self)) & ! { dg-error "impure function" } |
| 28 |
return |
| 29 |
end function |