This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50252] [OOP] Error message on "call x%y" (x not declared) can be more informative
- From: "arjen.markus895 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Sep 2011 07:18:30 +0000
- Subject: [Bug fortran/50252] [OOP] Error message on "call x%y" (x not declared) can be more informative
- Auto-submitted: auto-generated
- References: <bug-50252-4@http.gcc.gnu.org/bugzilla/>
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.
>