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

--- Comment #5 from janus at gcc dot gnu.org ---
One can get around the error with a patch like this:


diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index a2beb7fc90a..6b6e34c0d86 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13433,8 +13433,9 @@ resolve_typebound_procedure (gfc_symtree* stree)
          goto error;
        }

-      if (CLASS_DATA (me_arg)->ts.u.derived
-         != resolve_bindings_derived)
+      if ((CLASS_DATA (me_arg)->ts.u.derived != resolve_bindings_derived) &&
+         !(resolve_bindings_derived->attr.pdt_template
+           && gfc_str_startswith (CLASS_DATA (me_arg)->ts.u.derived->name,
"Pdt")))
        {
          gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of"
                     " the derived-type %qs", me_arg->name, proc->name,


It is sufficient to accept the code in comment #4, but otherwise not fully
complete. With this patch, the code in comment #0 is still rejected:


29 |    call b%foo()
   |             1
Error: ‘foo’ at (1) is not a member of the ‘pdttypedef’ structure

Reply via email to