PR middle-end/90923 - hash_map destroys elements without constructing them
authorMartin Sebor <msebor@redhat.com>
Mon, 1 Jul 2019 18:33:36 +0000 (18:33 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Mon, 1 Jul 2019 18:33:36 +0000 (12:33 -0600)
commit7b8795a138d0baa3b0505baee2ed05ae266977cd
tree74e86b5944db91f0d3068ed61906a8a389b0cf42
parent25cd9afbc1dc6bd9d4afccab3f09f0fbc811291a
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.

From-SVN: r272893
gcc/ChangeLog
gcc/hash-map-tests.c
gcc/hash-map.h
gcc/hash-set-tests.c
gcc/hash-set.h
gcc/hash-table.h