c++: -Wdangling-reference tweak to unbreak aarch64
commit8efcdbf59bfed2b888db7def16c7641f26927260
authorMarek Polacek <polacek@redhat.com>
Thu, 1 Feb 2024 21:11:43 +0000 (1 16:11 -0500)
committerMarek Polacek <polacek@redhat.com>
Thu, 1 Feb 2024 21:21:36 +0000 (1 16:21 -0500)
tree096f5de0a9054c6f1f756fda823b38f234e54b5e
parent44764984cf24e27cf7756cffd197283b9c62db8b
c++: -Wdangling-reference tweak to unbreak aarch64

My recent -Wdangling-reference change to not warn on std::span-like classes
unfortunately caused a new warning: extending reference_like_class_p also
opens the door to new warnings since we use reference_like_class_p for
checking the return type of the function: either it must be a reference
or a reference_like_class_p.

We can consider even non-templates as std::span-like to get rid of the
warning here.

gcc/cp/ChangeLog:

* call.cc (reference_like_class_p): Consider even non-templates for
std::span-like classes.

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wdangling-reference21.C: New test.
gcc/cp/call.cc
gcc/doc/invoke.texi
gcc/testsuite/g++.dg/warn/Wdangling-reference21.C [new file with mode: 0644]