[Bug fortran/50252] [OOP] Error message on "call x%y" (x not declared) can be more informative
arjen.markus895 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 1 07:18:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50252
--- Comment #3 from Arjen Markus <arjen.markus895 at gmail dot com> 2011-09-01 07:18:30 UTC ---
Hi Janus,
that seems quite to the point and it is much more straightforward than
my (minimal)
adjustment. Thanks.
The reason I brought this is that is a fairly recent addition and I
got puzzled by the
complaint that it was a syntax error.
Regards,
Arjen
2011/8/31 janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50252
>
> --- Comment #2 from janus at gcc dot gnu.org 2011-08-31 19:31:10 UTC ---
> Ok, here is one thing that could be easily done. Preliminary patch, not
> regtested. Does this sound like an improvement?
>
>
> Index: gcc/fortran/match.c
> ===================================================================
> --- gcc/fortran/match.c (revision 178293)
> +++ gcc/fortran/match.c (working copy)
> @@ -3639,15 +3639,24 @@ done:
> }
>
>
> -/* Match the call of a type-bound procedure, if CALL%var has already been
> - matched and var found to be a derived-type variable. */
> +/* Match the call of a type-bound procedure, if 'CALL var' has already been
> + matched. */
>
> static match
> match_typebound_call (gfc_symtree* varst)
> {
> gfc_expr* base;
> + gfc_symbol *sym;
> match m;
>
> + sym = varst->n.sym;
> + if (sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS)
> + {
> + gfc_error ("Base object '%s' in type-bound procedure call at %C "
> + "is not of derived type", sym->name);
> + return MATCH_ERROR;
> + }
> +
> base = gfc_get_expr ();
> base->expr_type = EXPR_VARIABLE;
> base->symtree = varst;
> @@ -3718,7 +3727,7 @@ gfc_match_call (void)
> procedure call. */
> if ((sym->attr.flavor != FL_PROCEDURE
> || gfc_is_function_return_value (sym, gfc_current_ns))
> - && (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS))
> + && gfc_peek_char() == '%')
> return match_typebound_call (st);
>
> /* If it does not seem to be callable (include functions so that the
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
More information about the Gcc-bugs
mailing list