re PR fortran/46313 ([OOP] class container naming collisions)

2011-01-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/46313
	* class.c (get_unique_type_string): Make type name start with upper
	case letter.


2011-01-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/46313
	* gfortran.dg/class_35.f90: New.

From-SVN: r168610
This commit is contained in:
Janus Weil 2011-01-09 11:35:50 +01:00
parent 4ee1aa2a94
commit b52956be02
4 changed files with 44 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2011-01-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/46313
* class.c (get_unique_type_string): Make type name start with upper
case letter.
2011-01-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/46405

View File

@ -116,13 +116,16 @@ gfc_class_null_initializer (gfc_typespec *ts)
static void
get_unique_type_string (char *string, gfc_symbol *derived)
{
{
char dt_name[GFC_MAX_SYMBOL_LEN+1];
sprintf (dt_name, "%s", derived->name);
dt_name[0] = TOUPPER (dt_name[0]);
if (derived->module)
sprintf (string, "%s_%s", derived->module, derived->name);
sprintf (string, "%s_%s", derived->module, dt_name);
else if (derived->ns->proc_name)
sprintf (string, "%s_%s", derived->ns->proc_name->name, derived->name);
sprintf (string, "%s_%s", derived->ns->proc_name->name, dt_name);
else
sprintf (string, "_%s", derived->name);
sprintf (string, "_%s", dt_name);
}

View File

@ -1,3 +1,8 @@
2011-01-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/46313
* gfortran.dg/class_35.f90: New.
2011-01-08 Iain Sandoe <iains@gcc.gnu.org>
* objc.dg/foreach-1.m: Add "-Wall" to flags.

View File

@ -0,0 +1,26 @@
! { dg-do run }
!
! PR 46313: [OOP] class container naming collisions
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
module one
type two_three
end type
end module
module one_two
type three
end type
end module
use one
use one_two
class(two_three), allocatable :: a1
class(three), allocatable :: a2
if (same_type_as(a1,a2)) call abort()
end
! { dg-final { cleanup-modules "one one_two" } }