libgomp/testsuite/libgomp.oacc-c++/declare-1.C
raw| 1 | #include <stdlib.h> |
| 2 | |
| 3 | template<class T> |
| 4 | T foo() |
| 5 | { |
| 6 | T a, b; |
| 7 | #pragma acc declare create (a) |
| 8 | |
| 9 | #pragma acc parallel copyout (b) |
| 10 | { |
| 11 | a = 5; |
| 12 | b = a; |
| 13 | } |
| 14 | |
| 15 | return b; |
| 16 | } |
| 17 | |
| 18 | int |
| 19 | main (void) |
| 20 | { |
| 21 | int rc; |
| 22 | |
| 23 | rc = foo<int>(); |
| 24 | |
| 25 | if (rc != 5) |
| 26 | abort (); |
| 27 | |
| 28 | return 0; |
| 29 | } |