From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gfortran.dg/dynamic_dispatch_6.f03 | 69 ++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/dynamic_dispatch_6.f03 (limited to 'gcc/testsuite/gfortran.dg/dynamic_dispatch_6.f03') diff --git a/gcc/testsuite/gfortran.dg/dynamic_dispatch_6.f03 b/gcc/testsuite/gfortran.dg/dynamic_dispatch_6.f03 new file mode 100644 index 000000000..e2d880e0e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dynamic_dispatch_6.f03 @@ -0,0 +1,69 @@ +! { dg-do run } +! +! PR 42144: [OOP] deferred TBPs do not work +! +! Contributed by Damian Rouson + +module field_module + implicit none + private + public :: field + type ,abstract :: field + end type +end module + +module periodic_5th_order_module + use field_module ,only : field + implicit none + type ,extends(field) :: periodic_5th_order + end type +end module + +module field_factory_module + implicit none + private + public :: field_factory + type, abstract :: field_factory + contains + procedure(create_interface), deferred :: create + end type + abstract interface + function create_interface(this) + use field_module ,only : field + import :: field_factory + class(field_factory), intent(in) :: this + class(field) ,pointer :: create_interface + end function + end interface +end module + +module periodic_5th_factory_module + use field_factory_module , only : field_factory + implicit none + private + public :: periodic_5th_factory + type, extends(field_factory) :: periodic_5th_factory + contains + procedure :: create=>new_periodic_5th_order + end type +contains + function new_periodic_5th_order(this) + use field_module ,only : field + use periodic_5th_order_module ,only : periodic_5th_order + class(periodic_5th_factory), intent(in) :: this + class(field) ,pointer :: new_periodic_5th_order + end function +end module + +program main + use field_module ,only : field + use field_factory_module ,only : field_factory + use periodic_5th_factory_module ,only : periodic_5th_factory + implicit none + class(field) ,pointer :: u + class(field_factory), allocatable :: field_creator + allocate (periodic_5th_factory :: field_creator) + u => field_creator%create() +end program + +! { dg-final { cleanup-modules "field_module periodic_5th_order_module field_factory_module periodic_5th_factory_module" } } -- cgit v1.2.3