https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118839
Bug ID: 118839
Summary: [OpenMP] Missing diagnostic when the variant is the
same as the base name
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: accepts-invalid, diagnostic, openmp
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Clang prints:
error: variant in '#pragma omp declare variant' is the same as the base
function
But GCC (C, C++ and Fortran) lacks such a diagnostic for
#pragma omp declare variant(g) match(user={condition(1)})
void g(int *x);
and
subroutine f()
!$omp declare variant(f) match(user={condition(.true.)})
end subroutine
* gcc and gfortran accept this silently
* while g++ outputs the odd:
foo554.c:1:29: error: ‘g’ was not declared in this scope; did you mean ‘g’?
1 | #pragma omp declare variant(g) match(user={condition(1)})
| ^
| g
foo554.c:2:6: note: ‘g’ declared here
2 | void g(int *x);
| ^