https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659
--- Comment #15 from Rafael Avila de Espindola <rafael.espindola at gmail dot com> --- (In reply to Jason Merrill from comment #14) > Right. My patch causes us to synthesize ~I so that it's available for > devirtualization, which we weren't doing before. This is allowed by the C++ > standard: 3.2p3 says "A virtual member function is odr-used if it is not > pure." so the compiler is free to instantiate/synthesize any virtual > function. > > Avoiding this while still getting the devirtualization benefit would require > some mechanism for devirtualization to call back into the front end to > trigger the instantiation/synthesis directly. This might be workable for an > individual translation unit, but not for LTO. And make which c++ errors user see dependent on which optimizations they run, which is not very friendly. I agree your approach is better. Markus Trippelsdorf: The include should go where it is used, so in GCMetadata.h.