blob: 948966e657f335c42decb3fc1624af92b263defd [file] [log] [blame]
// PR c++/119864
// { dg-additional-options "-fmodules -fopenmp" }
// { dg-module-cmi p1 }
export module p1;
export
template<unsigned>
struct T
{
double d;
T &operator +=(T const &x) { d += x.d; return *this; }
};
export
template<unsigned d>
T<d> sum(T<d> const *p, unsigned N)
{
T<d> Sum = {};
#pragma omp declare reduction(Op: T<d>: omp_out += omp_in) initializer(omp_priv = {})
#pragma omp parallel for reduction(Op: Sum)
for (unsigned i = 0u; i < N; ++i)
{
Sum += *p;
++p;
}
return Sum;
}