gcc/testsuite/gfortran.dg/pr102109.f90
raw| 1 | ! { dg-do compile } |
| 2 | ! |
| 3 | ! Contributed by Brad Richardson <[email protected]> |
| 4 | ! |
| 5 | program main |
| 6 | type :: sub_obj_t |
| 7 | integer :: val |
| 8 | end type |
| 9 | |
| 10 | type :: compound_obj_t |
| 11 | type(sub_obj_t) :: sub_obj |
| 12 | end type |
| 13 | |
| 14 | associate(initial_sub_obj => sub_obj_t(42)) |
| 15 | ! print *, initial_sub_obj%val ! Used to work with this uncommented |
| 16 | associate(obj => compound_obj_t(initial_sub_obj)) |
| 17 | if (obj%sub_obj%val .ne. 42) stop 1 |
| 18 | end associate |
| 19 | end associate |
| 20 | end program |