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;