https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86590
--- Comment #30 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The thing is that even with the foo that doesn't contain all those __builtin_constant_p 's after early inlining, we with -std=c++17 -O3 don't inline for some reason _M_construct.constprop, while we do inline it with -std=c++14. With -std=c++14 -O3 we are considering inlining _M_construct.constprop 4 times, into basic_string ctor twice and into foo twice, with -std=c++17 -O3 only 2 times, both into the ctor. Richard or Honza, can you please find out why the inliner doesn't consider inlining it into foo?