https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90923

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Author: msebor
Date: Mon Jul  1 18:33:36 2019
New Revision: 272893

URL: https://gcc.gnu.org/viewcvs?rev=272893&root=gcc&view=rev
Log:
PR middle-end/90923 - hash_map destroys elements without constructing them

gcc/ChangeLog:

        PR middle-end/90923
        * hash-map.h (hash_map::put): On insertion invoke element ctor.
        (hash_map::get_or_insert): Same.  Reformat comment.
        * hash-set.h (hash_set::add): On insertion invoke element ctor.
        * hash-map-tests.c (test_map_of_type_with_ctor_and_dtor): New.
        * hash-set-tests.c (test_map_of_type_with_ctor_and_dtor): New.
        * hash-table.h (hash_table::operator=): Prevent copy assignment.
         (hash_table::hash_table (const hash_table&)): Use copy ctor
         instead of assignment to copy elements.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/hash-map-tests.c
    trunk/gcc/hash-map.h
    trunk/gcc/hash-set-tests.c
    trunk/gcc/hash-set.h
    trunk/gcc/hash-table.h

Reply via email to