Commit f0051264 by Janus Weil

re PR fortran/57966 ([OOP] Using a TBP to specify the shape of a dummy argument)

2013-07-25  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/57966
	* resolve.c (resolve_typebound_function): Make sure the declared type,
	including its type-bound procedures, is resolved before resolving the
	actual type-bound call.

2013-07-25  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/57966
	* gfortran.dg/typebound_call_25.f90: New.

From-SVN: r201254
parent 4e30cb71
2013-07-25 Janus Weil <janus@gcc.gnu.org> 2013-07-25 Janus Weil <janus@gcc.gnu.org>
PR fortran/57966
* resolve.c (resolve_typebound_function): Make sure the declared type,
including its type-bound procedures, is resolved before resolving the
actual type-bound call.
2013-07-25 Janus Weil <janus@gcc.gnu.org>
PR fortran/57639 PR fortran/57639
* interface.c (compare_parameter): Check for class_ok. * interface.c (compare_parameter): Check for class_ok.
* simplify.c (gfc_simplify_same_type_as): Ditto. * simplify.c (gfc_simplify_same_type_as): Ditto.
......
...@@ -5686,6 +5686,8 @@ resolve_compcall (gfc_expr* e, const char **name) ...@@ -5686,6 +5686,8 @@ resolve_compcall (gfc_expr* e, const char **name)
} }
static bool resolve_fl_derived (gfc_symbol *sym);
/* Resolve a typebound function, or 'method'. First separate all /* Resolve a typebound function, or 'method'. First separate all
the non-CLASS references by calling resolve_compcall directly. */ the non-CLASS references by calling resolve_compcall directly. */
...@@ -5772,6 +5774,9 @@ resolve_typebound_function (gfc_expr* e) ...@@ -5772,6 +5774,9 @@ resolve_typebound_function (gfc_expr* e)
/* Get the CLASS declared type. */ /* Get the CLASS declared type. */
declared = get_declared_from_expr (&class_ref, &new_ref, e, true); declared = get_declared_from_expr (&class_ref, &new_ref, e, true);
if (!resolve_fl_derived (declared))
return false;
/* Weed out cases of the ultimate component being a derived type. */ /* Weed out cases of the ultimate component being a derived type. */
if ((class_ref && class_ref->u.c.component->ts.type == BT_DERIVED) if ((class_ref && class_ref->u.c.component->ts.type == BT_DERIVED)
......
2013-07-25 Janus Weil <janus@gcc.gnu.org>
PR fortran/57966
* gfortran.dg/typebound_call_25.f90: New.
2013-07-25 Paolo Carlini <paolo.carlini@oracle.com> 2013-07-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57981 PR c++/57981
......
! { dg-do compile }
!
! PR 57966: [OOP] Using a TBP to specify the shape of a dummy argument
!
! Contributed by Stefan Mauerberger <stefan.mauerberger@gmail.com>
MODULE my_mod
IMPLICIT NONE
TYPE config_cls
CONTAINS
PROCEDURE, NOPASS :: my_size
PROCEDURE, NOPASS :: my_sub
GENERIC :: sz => my_size
GENERIC :: sub => my_sub
END TYPE
TYPE(config_cls) :: config
CONTAINS
PURE INTEGER FUNCTION my_size()
my_size = 10
END FUNCTION
SUBROUTINE my_sub
END SUBROUTINE
SUBROUTINE test (field1, field2, field3, field4)
REAL :: field1 (config%my_size())
REAL :: field2 (config%sz())
REAL :: field3 (config%my_sub()) ! { dg-error "should be a FUNCTION" }
REAL :: field4 (config%sub()) ! { dg-error "should be a FUNCTION" }
END SUBROUTINE
END MODULE
! { dg-final { cleanup-modules "my_mod" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment