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

--- 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:f2061b2a9641c2228d4e2d86f19532ad7e93d627

commit r14-8636-gf2061b2a9641c2228d4e2d86f19532ad7e93d627
Author: Marek Polacek <pola...@redhat.com>
Date:   Thu Jan 25 12:08:14 2024 -0500

    c++: avoid -Wdangling-reference for std::span-like classes [PR110358]

    Real-world experience shows that -Wdangling-reference triggers for
    user-defined std::span-like classes a lot.  We can easily avoid that
    by considering classes like

        template<typename T>
        struct Span {
          T* data_;
          std::size len_;
        };

    to be std::span-like, and not warning for them.  Unlike the previous
    patch, this one considers a non-union class template that has a pointer
    data member and a trivial destructor as std::span-like.

            PR c++/110358
            PR c++/109640

    gcc/cp/ChangeLog:

            * call.cc (reference_like_class_p): Don't warn for std::span-like
            classes.

    gcc/ChangeLog:

            * doc/invoke.texi: Update -Wdangling-reference description.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wdangling-reference18.C: New test.
            * g++.dg/warn/Wdangling-reference19.C: New test.
            * g++.dg/warn/Wdangling-reference20.C: New test.

Reply via email to