http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60255
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |janus at gcc dot gnu.org --- Comment #2 from janus at gcc dot gnu.org --- The error message comes from find_intrinsic_vtab, to which we'd have to pass a locus in order to show a proper line number. Currently we use gfc_current_locus, which is no good since the error happens during resolution. Also I think the 'TODO' is not suitable here: It is meant for the developer and not the user, and as such belongs in the source code and not into an error message. What does it actually take to make this feature work? Simply removing the error and using internally charlen=0 to identify deferred length makes the test module compile: Index: class.c =================================================================== --- class.c (revision 207836) +++ class.c (working copy) @@ -2404,18 +2404,9 @@ find_intrinsic_vtab (gfc_typespec *ts) gfc_symbol *copy = NULL, *src = NULL, *dst = NULL; int charlen = 0; - if (ts->type == BT_CHARACTER) - { - if (ts->deferred) - { - gfc_error ("TODO: Deferred character length variable at %C cannot " - "yet be associated with unlimited polymorphic entities"); - return NULL; - } - else if (ts->u.cl && ts->u.cl->length - && ts->u.cl->length->expr_type == EXPR_CONSTANT) - charlen = mpz_get_si (ts->u.cl->length->value.integer); - } + if (ts->type == BT_CHARACTER && !ts->deferred && ts->u.cl && ts->u.cl->length + && ts->u.cl->length->expr_type == EXPR_CONSTANT) + charlen = mpz_get_si (ts->u.cl->length->value.integer); /* Find the top-level namespace. */ for (ns = gfc_current_ns; ns; ns = ns->parent) Apparently we do not handle any non-constant string lengths currently. I guess all of those should either be rejected (like deferred lengths) or we should just make them work.