gcc/libgomp/testsuite/libgomp.c++/pr81314.C
Jakub Jelinek 8b5865104c re PR c++/81314 (Undefined reference to a function with -fopenmp)
PR c++/81314
	* cp-gimplify.c (omp_var_to_track): Look through references.
	(omp_cxx_notice_variable): Likewise.

	* testsuite/libgomp.c++/pr81314.C: New test.

From-SVN: r252770
2017-09-14 22:18:17 +02:00

39 lines
391 B
C

// PR c++/81314
// { dg-do link }
template <int N>
struct S {
S () { s = 0; }
S (const S &x) { s = x.s; }
~S () {}
int s;
};
void
foo (S<2> &x)
{
#pragma omp taskloop
for (int i = 0; i < 100; ++i)
x.s++;
}
void
bar (S<3> &x)
{
#pragma omp task
x.s++;
}
int
main ()
{
S<2> s;
S<3> t;
#pragma omp parallel
#pragma omp master
{
foo (s);
bar (t);
}
}