]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix range for with PMFs [PR118923]
authorJakub Jelinek <jakub@redhat.com>
Tue, 25 Feb 2025 08:26:46 +0000 (09:26 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 25 Feb 2025 08:26:46 +0000 (09:26 +0100)
commita41b3f54c13890b1327bb3d4fbae8f7feb37d00b
tree0a6ad0badd395523a00cf50fd9769b8005279042
parent90b735b397c21688d95f1bbb42fba8ad3e17b30e
c++: Fix range for with PMFs [PR118923]

The following testcases segfault because the new range for -frange-for-ext-temps
temporary extension extends even the internal TARGET_EXPRs created by
get_member_function_from_ptrfunc.

The following patch fixes that by using get_internal_target_expr for those
instead of force_target_expr (similarly in cp_finish_decl and
build_comparison_op) and using force_target_expr inside of
get_internal_target_expr.

2025-02-25  Jakub Jelinek  <jakub@redhat.com>

PR c++/118923
* tree.cc (get_internal_target_expr): Use force_target_expr
instead of build_target_expr_with_type.
* typeck.cc (get_member_function_from_ptrfunc): Use
get_internal_target_expr instead of force_target_expr.
* decl.cc (cp_finish_decl): Likewise.
* method.cc (build_comparison_op): Likewise.

* g++.dg/cpp0x/pr118923.C: New test.
* g++.dg/cpp1y/pr118923.C: New test.
gcc/cp/decl.cc
gcc/cp/method.cc
gcc/cp/tree.cc
gcc/cp/typeck.cc
gcc/testsuite/g++.dg/cpp0x/pr118923.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/pr118923.C [new file with mode: 0644]