Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-25 Thread Marek Polacek via Gcc-patches
On Tue, Oct 25, 2022 at 11:39:31AM -0400, Jason Merrill wrote: > On 10/25/22 09:14, Marek Polacek wrote: > > On Tue, Oct 25, 2022 at 12:34:50PM +0100, Jonathan Wakely wrote: > > > On Mon, 24 Oct 2022 at 18:30, Jason Merrill wrote: > > > > > > > > On 10/21/22 19:28, Marek Polacek wrote: > > > > > W

Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-25 Thread Jason Merrill via Gcc-patches
On 10/25/22 09:14, Marek Polacek wrote: On Tue, Oct 25, 2022 at 12:34:50PM +0100, Jonathan Wakely wrote: On Mon, 24 Oct 2022 at 18:30, Jason Merrill wrote: On 10/21/22 19:28, Marek Polacek wrote: When testing a previous version of the patch, there were many FAILs in libstdc++'s 22_locale/; al

Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-25 Thread Marek Polacek via Gcc-patches
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

Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-25 Thread Marek Polacek via Gcc-patches
On Tue, Oct 25, 2022 at 12:34:50PM +0100, Jonathan Wakely wrote: > On Mon, 24 Oct 2022 at 18:30, Jason Merrill wrote: > > > > On 10/21/22 19:28, Marek Polacek wrote: > > > When testing a previous version of the patch, there were many FAILs in > > > libstdc++'s 22_locale/; all of them because the wa

Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-25 Thread Jonathan Wakely via Gcc-patches
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 X

Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-25 Thread Jonathan Wakely via Gcc-patches
On Mon, 24 Oct 2022 at 18:30, Jason Merrill wrote: > > On 10/21/22 19:28, Marek Polacek wrote: > > When testing a previous version of the patch, there were many FAILs in > > libstdc++'s 22_locale/; all of them because the warning triggered on > > > >const test_type& obj = std::use_facet(std::lo

Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-24 Thread Jason Merrill via Gcc-patches
On 10/21/22 19:28, Marek Polacek wrote: This patch implements a new experimental warning (enabled by -Wextra) to detect references bound to temporaries whose lifetime has ended. The Great! primary motivation is the Note in : Capturing the

[PATCH] c++: Implement -Wdangling-reference [PR106393]

2022-10-21 Thread Marek Polacek via Gcc-patches
This patch implements a new experimental warning (enabled by -Wextra) to detect references bound to temporaries whose lifetime has ended. The primary motivation is the Note in : Capturing the result of std::max by reference produces a dangling re