Re: [PATCH] Fix use-after-move in compile/compile-cplus-types.c

Keith Seitz
2018-09-17T15:25:50Z

On 09/17/2018 06:52 AM, Simon Marchi wrote:
> Patch
>
> d82b3862f12 ("compile: Remove non-const reference parameters")
>
> introduced a regression in compile/compile-cplus-types.c. The new_scope
> variable in compile_cplus_instance::enter_scope is used after it was
> std::moved. This patch fixes it by referring to the back of the vector
> where it was moved instead.
>
> gdb/ChangeLog:
>
> * compile/compile-cplus-types.c
> (compile_cplus_instance::enter_scope): Don't use new_scope after
> std::move.

That LGTM. [Although I would have used a const reference to it everywhere, but
six of one, ...]

Keith

PS. Reminder: IANAM, but you are. So please approve your patch. :-)