http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50640
--- Comment #21 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-07 16:27:24 UTC --- (In reply to comment #20) > The reason for the failure is clear: For the derived type/class, the function > __copy_xtt_Foo is created. The created function is in the scope of the derived > type - which is declared in program xtt. If one now places the "vtab" at the > top level, the copy function is hidden in another function as nested function. > > Hence, one also needs to create the function at top level; I wonder whether > this can be already done at decl time in gfc_find_derived_vtab. Post script: I was wondering whether it is possible to move the vtab to the top level as one might get in trouble with other member functions; however, as gfortran told me, a method (type-bound procedure) "must be a module procedure or an external procedure with an explicit interface". Hence, all methods are already visible at the toplevel. Thus, it only affects _copy which /can/ be moved to the toplevel.