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

            Bug ID: 120682
           Summary: declare mapper does not work with templates
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schulz.benjamin at googlemail dot com
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

OpenMP supports a declare mapper statement since version 5.
https://www.openmp.org/spec-html/5.2/openmpsu61.html

Lets test that with C++ templates in gcc and write:

#include "omp.h"

template <typename T>
struct myvec
{
size_t len;
T *data;
};

#pragma omp declare mapper(myvec<T> v) map(v, v.data[0:v.len])

int main()
{
return 0;
}


yields with compilation arguments 

-fopenmp -foffload=nvptx-none  -fno-stack-protector -std=c++23

to:

/home/benni/projects/openmptestnew/openmpoffloatest/main.cpp:17:21: Errpr:
expected »simd«, »reduction«, »target« or »variant« before »mapper«
   17 | #pragma omp declare mapper(myvec< T > v) map(v, v.data[0:v.len])
      |                     ^~~~~~

Reply via email to