On Thu, Dec 10, 2015 at 11:03 PM, Jason Merrill <ja...@redhat.com> wrote: > The C++ front end uses a temporary hash table to remember specializations of > local variables during template instantiations. In a nested function such > as a lambda or local class member function, we need to retain the elements > from the enclosing function's local_specializations table; otherwise the > testcase crashes because we don't find a local specialization for the > non-captured use of 'args' in the decltype. > > This patch addresses that by making a copy of the enclosing > local_specializations table if it exists; to enable that I've added copy > constructors to hash_table and hash_map. > > Tested x86_64-pc-linux-gnu. OK for trunk?
I don't think you can copy the elements with memcpy they may be C++ classes that are not copyable. Also watch out for the bool gather_mem_stats = true to bool gather_mem_stats = GATHER_STATISTICS change if that crosses your change. I also think copying hash tables should be discouraged ;) I wonder if you can get around the copying by adding a generation count (to easily "backtrack") instead. Richard.