http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60899
--- Comment #4 from davidxl <xinliangli at gmail dot com> --- (In reply to davidxl from comment #3) > (In reply to Jan Hubicka from comment #2) > > David, > > it seems a_m.C should be different form a.C. From chain of events you > > describe I think > > we need to figure out why the last folding happens. Does the function pass > > can_refer_decl_in_current_unit_p and if so, how does cgraph node look at > > that time? > > > > Honza > > Cut & paste error: > > // a_m.cc > > #include "a.h" > struct D2: public DI { > virtual int doit () { return 3; } > }; > > extern int bar(DI*); > int main() > { > D2 d2; > return bar(&d2); > } stepping into can_refer_decl_in_current_unit_p indicates it returns true (for A::foo and A::vtable) at the condition @line 106.