gcc/libgomp/testsuite/libgomp.c++/pr56217.C
Jakub Jelinek 6d840d9980 re PR c++/56217 (ICE: OpenMP: when combining shared() and a move constructor)
PR middle-end/56217
	* omp-low.c (use_pointer_for_field): Return false if
	lower_send_shared_vars doesn't generate any copy-out code.

	* g++.dg/gomp/pr56217.C: New test.

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

From-SVN: r195796
2013-02-06 11:34:53 +01:00

37 lines
545 B
C

// PR middle-end/56217
// { dg-do run }
// { dg-options "-std=c++0x" }
extern "C" void abort ();
template <typename T>
struct ptr {
T *p;
ptr () : p () {}
ptr (ptr &) = delete;
ptr (ptr &&o) : p(o) {}
operator T * () { return p; }
};
int a[6] = { 100, 101, 102, 103, 104, 105 };
static ptr<int>
f ()
{
ptr<int> pt;
#pragma omp task shared (pt)
pt.p = a + 2;
#pragma omp taskwait
return pt;
}
int
main ()
{
ptr<int> pt;
#pragma omp parallel
#pragma omp single
if (f () != a + 2 || *f () != 102)
abort ();
}