https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109640

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:9010fdba68063beccfbab0aa9ec8739f232ca2f4

commit r14-8375-g9010fdba68063beccfbab0aa9ec8739f232ca2f4
Author: Marek Polacek <pola...@redhat.com>
Date:   Fri Jan 19 13:59:41 2024 -0500

    c++: -Wdangling-reference and lambda false warning [PR109640]

    -Wdangling-reference checks if a function receives a temporary as its
    argument, and only warns if any of the arguments was a temporary.  But
    we should not warn when the temporary represents a lambda or we generate
    false positives as in the attached testcases.

            PR c++/113256
            PR c++/111607
            PR c++/109640

    gcc/cp/ChangeLog:

            * call.cc (do_warn_dangling_reference): Don't warn if the temporary
            is of lambda type.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wdangling-reference14.C: New test.
            * g++.dg/warn/Wdangling-reference15.C: New test.
            * g++.dg/warn/Wdangling-reference16.C: New test.

Reply via email to