re PR fortran/42353 ([OOP] Bogus Error: Name 'vtype$...' at (1) is an ambiguous reference ...)

gcc/fortran/
2009-12-28 Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42353
	* symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private.

gcc/testsuite/
2009-12-28  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42353
	* gfortran.dg/class_13.f03: New test.

From-SVN: r155494
This commit is contained in:
Janus Weil 2009-12-29 00:13:03 +01:00
parent 72b79d3945
commit aba7171d5f
4 changed files with 49 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-12-28 Janus Weil <janus@gcc.gnu.org>
PR fortran/42353
* symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private.
2009-12-27 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Daniel Kraft <d@domob.eu>

View File

@ -4748,6 +4748,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
vtab->attr.target = 1;
vtab->attr.save = SAVE_EXPLICIT;
vtab->attr.vtab = 1;
vtab->attr.access = ACCESS_PRIVATE;
vtab->refs++;
gfc_set_sym_referenced (vtab);
sprintf (name, "vtype$%s", derived->name);
@ -4764,6 +4765,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
return NULL;
vtype->refs++;
gfc_set_sym_referenced (vtype);
vtype->attr.access = ACCESS_PRIVATE;
/* Add component '$hash'. */
if (gfc_add_component (vtype, "$hash", &c) == FAILURE)

View File

@ -1,3 +1,8 @@
2009-12-28 Janus Weil <janus@gcc.gnu.org>
PR fortran/42353
* gfortran.dg/class_13.f03: New test.
2009-12-28 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/41344

View File

@ -0,0 +1,37 @@
! { dg-do compile }
!
! PR 42353: [OOP] Bogus Error: Name 'vtype$...' at (1) is an ambiguous reference ...
!
! Original test case by Harald Anlauf <anlauf@gmx.de>
! Modified by Janus Weil <janus@gcc.gnu.org>
module concrete_vector
type :: trivial_vector_type
end type
class(trivial_vector_type), pointer :: this
end module concrete_vector
module concrete_gradient
contains
subroutine my_to_vector (v)
use concrete_vector
class(trivial_vector_type) :: v
select type (v)
class is (trivial_vector_type)
end select
end subroutine
end module concrete_gradient
module concrete_inner_product
use concrete_vector
use concrete_gradient
contains
real function my_dot_v_v (a)
class(trivial_vector_type) :: a
select type (a)
class is (trivial_vector_type)
end select
end function
end module concrete_inner_product
! { dg-final { cleanup-modules "concrete_vector concrete_gradient concrete_inner_product" } }