https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114308

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #10 from anlauf at gcc dot gnu.org ---
(In reply to kargls from comment #9)
> I had 
> 
>     gfc_error ("Declared type of %qs has an ABSTRACT attribute, "
>                "it cannot appear in the array constructor at %L",
>                expr->symtree->name, &expr->where);
> 
> but the word 'it' seemed too vague to me.  Using NAG's message 
> would have
> 
>     gfc_error ("Array constructor value %qs at %L is of abstract type %qs",
>                expr->symtree->name, &expr->where, expr->ts.u.derived->name);
> 
> with the output
> 
> Array constructor value A_ARRAY is of abstract type __CLASS_MY_MODULE_A_1_0A
> 
> gfortran mangles names.  I suppose we can do
> 
>     gfc_error ("Array constructor value %qs at %L is of abstract type,
>                expr->symtree->name, &expr->where);
> 
> and leave out the name of the derived type.

There is already a solution: gfc_typename

      gfc_error ("Array constructor value %qs at %L is of abstract type %qs",
                 expr->symtree->name, &expr->where, gfc_typename (&expr->ts));

This gives:

Error: Array constructor value 'a_array' at (1) is of abstract type 'CLASS(a)'

Reply via email to