Re: [PATCH] c++: Disable -Wdangling-reference when initing T

2022-11-14 Thread Jason Merrill via Gcc-patches
On 11/11/22 10:22, Marek Polacek wrote: Non-const lvalue references can't bind to a temporary, so the warning should not be emitted if we're initializing something of that type. I'm not disabling the warning when the function itself returns a non-const lvalue reference, that would regress at

[PATCH] c++: Disable -Wdangling-reference when initing T

2022-11-11 Thread Marek Polacek via Gcc-patches
Non-const lvalue references can't bind to a temporary, so the warning should not be emitted if we're initializing something of that type. I'm not disabling the warning when the function itself returns a non-const lvalue reference, that would regress at least const int =