https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118859
Bug ID: 118859
Summary: [C++] dispatch accepts non-pointer template argument
with adjust_args
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: accepts-invalid, diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
CC: parras at gcc dot gnu.org
Target Milestone: ---
Testcase: g++.dg/gomp/adjust-args-2.C of r15-5518-ged49709acda493
The following won't fly:
template <typename T>
T f0(T a, T *b);
#pragma omp declare variant (f0) match (construct={dispatch}) \
adjust_args (need_device_ptr: a, b)
template <typename T>
T f1(T a, T *b);
...
int *a, b;
...
#pragma omp dispatch
f1(b, a);
Namely: 'f1(int, int *)' — that's fine in the C++ sense
but not when doing a need_device_ptr of an 'int' does not make sense.
* * *
In gcc/cp/parser.cc, there is the diagnostic:
if (!is_ptr_or_template)
{
error_at (arg_loc, "%qD is not a C pointer",
decl);
But the corresponding is-template diagnostic is missing in gcc/cp/decl.cc's
omp_declare_variant_finalize_one