On Tue, 2021-06-15 at 19:48 -0600, Martin Sebor wrote: Thanks for writing the patch.
> While debugging locations I noticed the semi_embedded_vec template > in line-map.h doesn't declare a copy ctor or copy assignment, but > is being copied in a couple of places in the C++ parser (via > gcc_rich_location). It gets away with it most likely because it > never grows beyond the embedded buffer. Where are these places? I wasn't aware of this. > > The attached patch defines the copy ctor and also copy assignment > and adds the corresponding move functions. Note that rich_location::m_fixit_hints "owns" the fixit_hint instances, manually deleting them in rich_location's dtor, so simply doing a shallow copy of it would be wrong. Also, a rich_location stores other pointers (to range_labels and diagnostic_path), which are borrowed pointers, where their lifetime is assumed to outlive any (non-dtor) calls to the rich_location. So I'm nervous about code that copies rich_location instances. I think I'd prefer to forbid copying them; what's the use-case for copying them? Am I missing something here? > > Tested on x86_64-linux. > > Martin Thanks Dave