<div dir="ltr">Perhaps I should remove the old lists from my contacts...<br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">David Blaikie</b> <span dir="ltr"><<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>></span><br>Date: Tue, Aug 18, 2015 at 8:39 PM<br>Subject: Code carefully copying LookupResults which aren't exactly copyable<br>To: Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>>, Kaelyn Takata <<a href="mailto:rikka@google.com">rikka@google.com</a>>, cfe-dev Developers <<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>><br><br><br><div dir="ltr">More -Wdeprecated cleanup.<br><br>Turns out LookupResults are copied in at least one place:<br><br>SemaExprMember.cpp:651<br><br>Essentially this function takes a LookupResult, captures it by value into a lambda, within the body of the lambda it suppresses diagnostics on the LookupResult and then does some other stuff.<br><br>LookupResult's dtor does a couple of things - it emits diagnostics, if needed. And it destroys the CXXBasePaths in the LookupResult. As luck/design would have it, the LookupResult that is copied here never has a non-null CXXBasePaths and, as mentioned, always disables diagnostics (if the lambda is actually called - if it is not, maybe bad things could happen? It could emit diagnostics unintentionally?).<br><br>Having LookupResult be copyable in general seems problematic - if extra care is not taken it could easily double delete and/or emit excess diagnostics.<br><br>Any ideas how this might be improved?<br><br>Honestly I seem to recall being involved in the code review, and maybe I even suggested this approach, not knowing what monsters lurked beneath. Maybe the original code ferried just the right LookupResult parameters across the capture boundary? That would be safe & then we could make LookupResult non-copyable again. (& can unique_ptr the CXXBasePaths (or even Optional<CXXBasePaths>) eventually)<br><br>- Dave</div>
</div><br></div>