https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71258
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Phosit from comment #5) > struct Base{ > virtual ~Base() = default; > }; > > int main(){ > delete new Base; > return 0; > } > > In this partial test case the destructor is not inlined. > Curiously when changing the function name the destructor is inlined. > I compiled with -O3 Yes main is known to be only called once so heuristics decide inlining is not profitable. Gcc does this because things called directly from main (without a loop) is usually not on the hot path of applications.