This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/52010] [OOP] Intrinsic assignment of a CLASS to a TYPE
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Jan 2012 16:06:51 +0000
- Subject: [Bug fortran/52010] [OOP] Intrinsic assignment of a CLASS to a TYPE
- Auto-submitted: auto-generated
- References: <bug-52010-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52010
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-27 16:06:51 UTC ---
The following handles the checking part. However, one also needs to handle the
access internally (in trans-expr.c). Namely:
type_var = class_var
type_var = class_function ()
and both for "scalar = scalar", "array = scalar" and "array = array". Note that
the class_function can also be an intrinsic function such as RESHAPE. (Cf.
PR47505.)
--- expr.c (revision 183625)
+++ expr.c (working copy)
@@ -3256,3 +3256,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_
- if (gfc_compare_types (&lvalue->ts, &rvalue->ts))
+ if (lvalue->ts.type == BT_DERIVED && rvalue->ts.type == BT_CLASS)
+ {
+ if (gfc_compare_types (&lvalue->ts, &CLASS_DATA (rvalue)->ts))
+ return SUCCESS;
+ }
+ else if (gfc_compare_types (&lvalue->ts, &rvalue->ts))
return SUCCESS;