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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sandra Loosemore <san...@gcc.gnu.org>:

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

commit r16-3405-ga43c30cb6f451d60b7e19be09da075ab0ff5830f
Author: Sandra Loosemore <sloosem...@baylibre.com>
Date:   Mon Aug 25 01:43:50 2025 +0000

    OpenMP: give error when variant is the same as the base function [PR118839]

    As noted in the issue, the C++ front end has deeper problems: it's
    supposed to do the name lookup of the variant at the call site but is
    instead doing it when parsing the "declare variant" construct, before
    registering the decl for the base function.  The C++ part of the
    patch is a band-aid to catch the case where there is a previous declaration
    of the function and it doesn't give an undefined symbol error instead.
    Some real solution ought to be included as part of fixing PR118791.

    gcc/c/
            PR middle-end/118839
            * c-parser.cc (c_finish_omp_declare_variant): Error if variant
            is the same as base.

    gcc/cp/
            PR middle-end/118839
            * decl.cc (omp_declare_variant_finalize_one): Error if variant
            is the same as base.

    gcc/fortran/
            PR middle-end/118839
            * trans-openmp.cc (gfc_trans_omp_declare_variant): Error if variant
            is the same as base.

    gcc/testsuite/
            PR middle-end/118839
            * gcc.dg/gomp/declare-variant-3.c: New.
            * gfortran.dg/gomp/declare-variant-22.f90: New.

Reply via email to