Alexey Bataev | c640058 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | struct St{ |
| 5 | int a; |
| 6 | }; |
| 7 | |
| 8 | struct St1{ |
| 9 | int a; |
| 10 | static int b; |
| 11 | // CHECK: static int b; |
| 12 | #pragma omp threadprivate(b) |
| 13 | // CHECK-NEXT: #pragma omp threadprivate(b) |
| 14 | } d; |
| 15 | |
| 16 | int a, b; |
| 17 | // CHECK: int a; |
| 18 | // CHECK: int b; |
| 19 | #pragma omp threadprivate(a) |
| 20 | // CHECK-NEXT: #pragma omp threadprivate(a) |
| 21 | #pragma omp threadprivate(d, b) |
| 22 | // CHECK-NEXT: #pragma omp threadprivate(d,b) |
| 23 | |
| 24 | template <class T> T foo() { |
| 25 | static T v; |
| 26 | #pragma omp threadprivate(v) |
| 27 | return v; |
| 28 | } |
| 29 | //CHECK: template <class T = int> int foo() { |
| 30 | //CHECK-NEXT: static int v; |
| 31 | //CHECK-NEXT: #pragma omp threadprivate(v) |
| 32 | //CHECK: template <class T> T foo() { |
| 33 | //CHECK-NEXT: static T v; |
| 34 | //CHECK-NEXT: #pragma omp threadprivate(v) |
| 35 | |
| 36 | int main () { |
| 37 | static int a; |
| 38 | // CHECK: static int a; |
| 39 | #pragma omp threadprivate(a) |
| 40 | // CHECK-NEXT: #pragma omp threadprivate(a) |
| 41 | a=2; |
| 42 | return (foo<int>()); |
| 43 | } |