diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/deferred_character_13.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/deferred_character_13.f90 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/deferred_character_13.f90 b/gcc/testsuite/gfortran.dg/deferred_character_13.f90 new file mode 100644 index 00000000000..822cc5de3a8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/deferred_character_13.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! +! Tests the fix for PR49630 comment #3. +! +! Contributed by Janus Weil <janus@gcc.gnu.org> +! +module abc + implicit none + + type::abc_type + contains + procedure::abc_function + end type abc_type + +contains + + function abc_function(this) + class(abc_type),intent(in)::this + character(:),allocatable::abc_function + allocate(abc_function,source="hello") + end function abc_function + + subroutine do_something(this) + class(abc_type),intent(in)::this + if (this%abc_function() .ne. "hello") call abort + end subroutine do_something + +end module abc + + + use abc + type(abc_type) :: a + call do_something(a) +end |