summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/symbol.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_class_1.f9035
4 files changed, 50 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 92a5f00c0a2..7f9a1a5ccb3 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2013-04-01 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/56500
+ * symbol.c (gfc_set_default_type): Build class container for
+ IMPLICIT CLASS.
+
2013-03-31 Tobias Burnus <burnus@net-b.de>
* class.c (finalization_scalarizer, finalizer_insert_packed_call,
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index ec64231da8f..6fc5812b218 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -261,6 +261,10 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns)
if (ts->type == BT_CHARACTER && ts->u.cl)
sym->ts.u.cl = gfc_new_charlen (sym->ns, ts->u.cl);
+ else if (ts->type == BT_CLASS
+ && gfc_build_class_symbol (&sym->ts, &sym->attr,
+ &sym->as, false) == FAILURE)
+ return FAILURE;
if (sym->attr.is_bind_c == 1 && gfc_option.warn_c_binding_type)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 48bebd0fe5e..c1fc14d4bb4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-01 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/56500
+ * gfortran.dg/implicit_class_1.f90: New.
+
2013-03-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/56786
diff --git a/gcc/testsuite/gfortran.dg/implicit_class_1.f90 b/gcc/testsuite/gfortran.dg/implicit_class_1.f90
new file mode 100644
index 00000000000..329f57aaa12
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/implicit_class_1.f90
@@ -0,0 +1,35 @@
+! { dg-do run }
+!
+! PR 56500: [OOP] "IMPLICIT CLASS(...)" wrongly rejected
+!
+! Contributed by Reinhold Bader <Reinhold.Bader@lrz.de>
+
+program upimp
+ implicit class(foo) (a-b)
+ implicit class(*) (c)
+ type :: foo
+ integer :: i
+ end type
+ allocatable :: aaf, caf
+
+ allocate(aaf, source=foo(2))
+ select type (aaf)
+ type is (foo)
+ if (aaf%i /= 2) call abort
+ class default
+ call abort
+ end select
+
+ allocate(caf, source=foo(3))
+ select type (caf)
+ type is (foo)
+ if (caf%i /= 3) call abort
+ class default
+ call abort
+ end select
+
+contains
+ subroutine gloo(x)
+ implicit class(*) (a-z)
+ end
+end program