c++: suppress -Wdangling-reference for std::span [PR107532]
commitced122b849b8961b854053f0d1ac96983c5802e5
authorMarek Polacek <polacek@redhat.com>
Fri, 10 Mar 2023 17:23:13 +0000 (10 12:23 -0500)
committerMarek Polacek <polacek@redhat.com>
Mon, 13 Mar 2023 15:21:25 +0000 (13 11:21 -0400)
treec6c9dbf76849dcc75c3694f484014006581af739
parent7ef44579787af646d5bae13a91a49ef5d2048f5c
c++: suppress -Wdangling-reference for std::span [PR107532]

std::span is a view and therefore should be treated as a reference
wrapper class for the purposes of -Wdangling-reference.  I'm not sure
there's a pattern that we could check for.

PR c++/107532

gcc/cp/ChangeLog:

* call.cc (reference_like_class_p): Check for std::span.

gcc/testsuite/ChangeLog:

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