https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118486

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>:

https://gcc.gnu.org/g:b67a0d6aca0c049e14e44c3f28ce3806680543ef

commit r15-6911-gb67a0d6aca0c049e14e44c3f28ce3806680543ef
Author: Tobias Burnus <tbur...@baylibre.com>
Date:   Wed Jan 15 10:47:29 2025 +0100

    OpenMP/C++: Fix 'declare variant' for struct-returning functions [PR118486]

    To find the variant declaration, a call is constructed in
    omp_declare_variant_finalize_one, which gives here:
      TARGET_EXPR <D.3010, variant_fn ()>

    Extracting now the function declaration failed and gave the bogus
      error: could not find variant declaration

    Solution: Use the 2nd argument of the TARGET_EXPR and continue.

            PR c++/118486

    gcc/cp/ChangeLog:

            * decl.cc (omp_declare_variant_finalize_one): When resolving
            the variant to use, handle variant calls with TARGET_EXPR.

    gcc/testsuite/ChangeLog:

            * g++.dg/gomp/declare-variant-11.C: New test.

Reply via email to