aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-edge.h
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-03-17 14:36:10 -0400
committerMarek Polacek <polacek@redhat.com>2023-03-23 09:25:41 -0400
commit59bfdd5f467292a368d0d628084a4b65d1bb06bb (patch)
treef50a5eaa6ce601ea9751a42f0cb8cb7eae11d367 /gcc/gimple-range-edge.h
parent3b97715af0e848ef8703ac04665bde562b2ac159 (diff)
downloadgcc-59bfdd5f467292a368d0d628084a4b65d1bb06bb.zip
gcc-59bfdd5f467292a368d0d628084a4b65d1bb06bb.tar.gz
gcc-59bfdd5f467292a368d0d628084a4b65d1bb06bb.tar.bz2
c++: further -Wdangling-reference refinement [PR107532]
Based on <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532#c24>, it seems like we should treat *any* class with a reference member as a reference wrapper. To suppress the warning in int i = 42; auto const& v = std::get<0>(std::tuple<int&>(i)); we have to look into base classes as well. For std::tuple, this means that we have to check the _Head_base subobject, which is a non-direct base class of std::tuple. So I've employed a DFS walk. PR c++/107532 gcc/cp/ChangeLog: * call.cc (class_has_reference_member_p): New. (class_has_reference_member_p_r): New. (reference_like_class_p): Don't look for a specific constructor. Use a DFS walk with class_has_reference_member_p_r. gcc/testsuite/ChangeLog: * g++.dg/warn/Wdangling-reference11.C: New test. * g++.dg/warn/Wdangling-reference12.C: New test.
Diffstat (limited to 'gcc/gimple-range-edge.h')
0 files changed, 0 insertions, 0 deletions