On Tue, Oct 25, 2022 at 12:50:36PM +0100, Jonathan Wakely wrote: > On Sat, 22 Oct 2022 at 00:28, Marek Polacek wrote: > > I've run the testsuite/bootstrap with the warning enabled by default. > > There were just a few FAILs: > > * g++.dg/warn/Wdangling-pointer-2.C > > * 20_util/any/misc/any_cast.cc > > * 20_util/forward/c_neg.cc > > * 20_util/forward/f_neg.cc > > These two are XFAIL tests, they're checking for a required static > assert due to misusing std::forward, so I don't think we want to > change them to remove a "bug" (they're meant to be buggy). > I think they should use -Wno-dangling-reference
I think we don't have to do anything: -Wdangling-reference is only enabled by -Wextra and that isn't used in these tests. I was just curious about the warning's impact. > > * experimental/any/misc/any_cast.cc > > all of these look like genuine bugs. A bootstrap with the warning > > enabled by default passed. > > > I've attached a patch for the two any_cast.cc tests that avoids > creating dangling references, without changing the intended behaviour > of the tests. Thanks a lot! Marek