https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92300
--- Comment #2 from Antonio Di Monaco <antonio.di.monaco at sap dot com> --- Well, I tried, but nothing changes. assert(a.insert(std::make_pair< const int, int >(1, 1)).second); assert(a.insert(std::make_pair< const int, int >(2, 2)).second); assert(!a.insert(std::make_pair< const int, int >(1, 3)).second); still allocates three times, while GCC6 two times. Even changing K to const int in the map does not produce any different behavior.