On Fri, 2 Aug 2024, Marek Polacek wrote: > On Thu, Aug 01, 2024 at 05:18:35PM -0400, Jason Merrill wrote: > > On 8/1/24 4:20 PM, Marek Polacek wrote: > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > > > -- >8 -- > > > Despite a number of mitigations (don't warn for std::span-like classes, > > > lambdas, adding [[gnu::no_dangling]], etc.), the warning still seems to > > > cause some grief. Let's move the warning to -Wextra, then. > > > > Any references to the grief? > > Two recent: > https://gcc.gnu.org/PR115361 > https://gcc.gnu.org/PR115730
FWIW PR115361 suggested adding another mitigation: Since the heuristic is concerned only with dangling references to *members of the GetKey object itself*, could you maybe add yet another heuristic to suppress the warning whenever the GetKey object is_empty? That seems sensible to me, and would also resolve PR115229. > > > The patch is OK. > > Thanks. > > Marek > >