| 1 |
! { dg-do compile } |
| 2 |
! Tests the fix for PR28771 in which an assumed character length variable with an initializer could |
| 3 |
! survive in the main program without causing an error. |
| 4 |
! |
| 5 |
! Contributed by Martin Reinecke <[email protected]> |
| 6 |
! Modified to test fix of regression reported by [email protected] |
| 7 |
|
| 8 |
subroutine poobar () |
| 9 |
! The regression caused an ICE here |
| 10 |
CHARACTER ( LEN = * ), PARAMETER :: Markers(5) = (/ "Error ", & |
| 11 |
& "Fehler", & |
| 12 |
& "Erreur", & |
| 13 |
& "Stop ", & |
| 14 |
& "Arret " /) |
| 15 |
character(6) :: recepteur (5) |
| 16 |
recepteur = Markers |
| 17 |
end subroutine poobar |
| 18 |
|
| 19 |
! If the regression persisted, the compilation would stop before getting here |
| 20 |
program test |
| 21 |
character(len=*), parameter :: foo = 'test' ! Parameters must work. |
| 22 |
character(len=4) :: bar = foo |
| 23 |
character(len=*) :: foobar = 'This should fail' ! { dg-error "must be a dummy" } |
| 24 |
print *, bar |
| 25 |
call poobar () |
| 26 |
end |
| 27 |
|