https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90923
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=90904 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The otherwise untested patch is enough to fix the test case: diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 588dfda04fa..40e5ec5871e 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -177,7 +177,10 @@ public: INSERT); bool ins = Traits::is_empty (*e); if (ins) - e->m_key = k; + { + e->m_key = k; + new ((void *)&e->m_value) Value (); + } if (existed != NULL) *existed = !ins;