https://gcc.gnu.org/g:f7ae087ef0132b01c3a2c04932058b996ebda18d
commit r15-4801-gf7ae087ef0132b01c3a2c04932058b996ebda18d Author: Tobias Burnus <tbur...@baylibre.com> Date: Thu Oct 31 12:37:46 2024 +0100 OpenMP/C++: Use STRIP_REFERENCE_REF to fix declare variant with reference-returning functions As Jakub suggested, use STRIP_REFERENCE_REF instead of doing it manually as r15-4800-geb828a1e380e7b did. gcc/cp/ChangeLog: * decl.cc (omp_declare_variant_finalize_one): Use STRIP_REFERENCE_REF instead of doing it manually. Diff: --- gcc/cp/decl.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index b638f3af294d..0e4533c6faba 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -8375,10 +8375,7 @@ omp_declare_variant_finalize_one (tree decl, tree attr) if (variant == error_mark_node && !processing_template_decl) return true; - if (TREE_CODE (variant) == INDIRECT_REF) - variant = TREE_OPERAND (variant, 0); - - variant = cp_get_callee_fndecl_nofold (variant); + variant = cp_get_callee_fndecl_nofold (STRIP_REFERENCE_REF (variant)); input_location = save_loc; if (variant)