From 5cd2f8152d6741a4c793e0c7340470ca71009bfb Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Tue, 22 Jun 2010 19:07:06 +0200 Subject: [PATCH] re PR fortran/44616 ([OOP] ICE if CLASS(foo) is used before its definition) 2010-06-22 Janus Weil PR fortran/44616 * resolve.c (resolve_fl_derived): Avoid checking for abstract on class containers. 2010-06-22 Janus Weil PR fortran/44616 * gfortran.dg/abstract_type_8.f03: New. From-SVN: r161208 --- gcc/fortran/ChangeLog | 6 ++++ gcc/fortran/resolve.c | 1 + gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gfortran.dg/abstract_type_8.f03 | 29 +++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/abstract_type_8.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1385318d550..07a5825123b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2010-06-22 Janus Weil + + PR fortran/44616 + * resolve.c (resolve_fl_derived): Avoid checking for abstract on class + containers. + 2010-06-21 Tobias Burnus PR fortran/40632 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 20def447767..96b3e8daab1 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -11144,6 +11144,7 @@ resolve_fl_derived (gfc_symbol *sym) /* If this is a non-ABSTRACT type extending an ABSTRACT one, ensure that all DEFERRED bindings are overridden. */ if (super_type && super_type->attr.abstract && !sym->attr.abstract + && !sym->attr.is_class && ensure_not_abstract (sym, super_type) == FAILURE) return FAILURE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 54d13fd22c5..326f2bcc4ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-22 Janus Weil + + PR fortran/44616 + * gfortran.dg/abstract_type_8.f03: New. + 2010-06-21 Jason Merrill * g++.dg/cpp0x/noexcept08.C: New. diff --git a/gcc/testsuite/gfortran.dg/abstract_type_8.f03 b/gcc/testsuite/gfortran.dg/abstract_type_8.f03 new file mode 100644 index 00000000000..c924abac9af --- /dev/null +++ b/gcc/testsuite/gfortran.dg/abstract_type_8.f03 @@ -0,0 +1,29 @@ +! { dg-do compile } +! +! PR 44616: [OOP] ICE if CLASS(foo) is used before its definition +! +! Contributed by bd satish + +module factory_pattern +implicit none + +type First_Factory + character(len=20) :: factory_type + class(Connection), pointer :: connection_type + contains +end type First_Factory + +type, abstract :: Connection + contains + procedure(generic_desc), deferred :: description +end type Connection + +abstract interface + subroutine generic_desc(self) + import ! Required, cf. PR 44614 + class(Connection) :: self + end subroutine generic_desc +end interface +end module factory_pattern + +! { dg-final { cleanup-modules "factory_pattern" } }