http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55037
--- Comment #3 from janus at gcc dot gnu.org 2012-10-24 09:45:59 UTC --- (In reply to comment #1) > It seems likely a fallout of revision 191649 which introduced the assert > > gcc_assert (fsym->ts.u.derived == e->ts.u.derived); Indeed I think removing this assert is sufficient for solving the problem in comment 0. Since both the formal arg "y" as well as the expression being passed to it ("tmp") are polymorphic, the ts.u.derived points to the class container in both cases. Now, the class container of "y" lives in m1, while that of "tmp" lives in m2 (apparently the "use, only" prevents it from being carried over). In principle this is not a big problem, we just should not assume they are equal ;) If anything, we could assume that the types themselves (not the class containers) should be equal. But firstly, even this may not be strictly necessary (I'm not 100% sure right now), and secondly such conditions should have been checked by the present argument checking machinery.