https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86141
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WONTFIX Component|tree-optimization |ipa Status|NEW |RESOLVED CC| |marxin at gcc dot gnu.org --- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> --- There is nothing to fix here really. This is just inliner doing what it is told to do with respect to main. You can change your benchmarking like this: int h() { DataType data = {1, 2, 3, 4, 'A', 'B'}; puts( "First Encapsulation Method" ); DisplayView1Type( View1Type( data ) ); DisplayView2Type( View2Type( data ) ); puts( "Second Encapsulation Method" ); DisplayViewType( ViewType::view1( data ) ); DisplayViewType( ViewType::view2( data ) ); return 0; } int main(void) { return h(); } And GCC will do the correct thing.