| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test fix for PR121060. |
| 4 |
! |
| 5 |
! Contributed by Damian Rouson <[email protected]> |
| 6 |
! |
| 7 |
module subdomain_m |
| 8 |
implicit none |
| 9 |
|
| 10 |
type subdomain_t |
| 11 |
real :: s_ = 99. |
| 12 |
contains |
| 13 |
generic :: operator(.laplacian.) => laplacian |
| 14 |
procedure laplacian |
| 15 |
end type |
| 16 |
|
| 17 |
contains |
| 18 |
|
| 19 |
function laplacian(rhs) |
| 20 |
class(subdomain_t), intent(in) :: rhs |
| 21 |
type(subdomain_t) laplacian |
| 22 |
laplacian%s_ = rhs%s_ + 42 |
| 23 |
end function |
| 24 |
|
| 25 |
end module |
| 26 |
|
| 27 |
use subdomain_m |
| 28 |
implicit none |
| 29 |
|
| 30 |
type operands_t |
| 31 |
real :: s_ |
| 32 |
end type |
| 33 |
|
| 34 |
type(subdomain_t) phi |
| 35 |
type(operands_t) operands |
| 36 |
|
| 37 |
associate(laplacian_phi => .laplacian. phi) ! ICE because specific not found. |
| 38 |
operands = approximates(laplacian_phi%s_) |
| 39 |
end associate |
| 40 |
|
| 41 |
if (int (operands%s_) /= 42) stop 1 |
| 42 |
contains |
| 43 |
|
| 44 |
function approximates(actual) |
| 45 |
real actual |
| 46 |
type(operands_t) approximates |
| 47 |
approximates%s_ = actual - 99 |
| 48 |
end function |
| 49 |
|
| 50 |
end |