Commit 49860194 by Janus Weil

re PR fortran/49562 ([OOP] assigning value to type-bound function)

2011-07-02  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49562
	* expr.c (gfc_check_vardef_context): Handle type-bound procedures.


2011-07-02  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49562
	* gfortran.dg/typebound_proc_23.f90: New.

From-SVN: r175779
parent fe8ac8e4
2011-07-02 Janus Weil <janus@gcc.gnu.org>
PR fortran/49562
* expr.c (gfc_check_vardef_context): Handle type-bound procedures.
2011-06-30 Jakub Jelinek <jakub@redhat.com> 2011-06-30 Jakub Jelinek <jakub@redhat.com>
PR fortran/49540 PR fortran/49540
......
...@@ -4394,8 +4394,8 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, ...@@ -4394,8 +4394,8 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym; sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym;
} }
if (!pointer && e->expr_type == EXPR_FUNCTION attr = gfc_expr_attr (e);
&& sym->result->attr.pointer) if (!pointer && e->expr_type == EXPR_FUNCTION && attr.pointer)
{ {
if (!(gfc_option.allow_std & GFC_STD_F2008)) if (!(gfc_option.allow_std & GFC_STD_F2008))
{ {
...@@ -4432,7 +4432,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, ...@@ -4432,7 +4432,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
/* Find out whether the expr is a pointer; this also means following /* Find out whether the expr is a pointer; this also means following
component references to the last one. */ component references to the last one. */
attr = gfc_expr_attr (e);
is_pointer = (attr.pointer || attr.proc_pointer); is_pointer = (attr.pointer || attr.proc_pointer);
if (pointer && !is_pointer) if (pointer && !is_pointer)
{ {
......
2011-07-02 Janus Weil <janus@gcc.gnu.org>
PR fortran/49562
* gfortran.dg/typebound_proc_23.f90: New.
2011-07-01 Jonathan Wakely <jwakely.gcc@gmail.com> 2011-07-01 Jonathan Wakely <jwakely.gcc@gmail.com>
PR c++/49605 PR c++/49605
......
! { dg-do run }
!
! PR 49562: [4.6/4.7 Regression] [OOP] assigning value to type-bound function
!
! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
module ice
type::ice_type
contains
procedure::ice_func
end type
integer, target :: it = 0
contains
function ice_func(this)
integer, pointer :: ice_func
class(ice_type)::this
ice_func => it
end function ice_func
subroutine ice_sub(a)
class(ice_type)::a
a%ice_func() = 1
end subroutine ice_sub
end module
use ice
type(ice_type) :: t
if (it/=0) call abort()
call ice_sub(t)
if (it/=1) call abort()
end
! { dg-final { cleanup-modules "ice" } }
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