brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · 26bf6c6 Raw
193 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized4 5void foo() {6}7 8bool foobool(int argc) {9  return argc;10}11 12struct S1; // expected-note 2 {{declared here}}13class S2 {14  mutable int a;15 16public:17  S2() : a(0) {}18  S2 &operator=(S2 &s2) { return *this; }19};20class S3 {21  int a;22 23public:24  S3() : a(0) {}25  S3 &operator=(S3 &s3) { return *this; }26};27class S4 {28  int a;29  S4();30  S4 &operator=(const S4 &s4); // expected-note 3 {{implicitly declared private here}}31 32public:33  S4(int v) : a(v) {}34};35class S5 {36  int a;37  S5() : a(0) {}38  S5 &operator=(const S5 &s5) { return *this; } // expected-note 3 {{implicitly declared private here}}39 40public:41  S5(int v) : a(v) {}42};43template <class T>44class ST {45public:46  static T s;47};48 49S2 k;50S3 h;51S4 l(3);52S5 m(4);53#pragma omp threadprivate(h, k, l, m)54 55namespace A {56double x;57#pragma omp threadprivate(x)58}59namespace B {60using A::x;61}62 63template <class T, typename S, int N>64T tmain(T argc, S **argv) {65  T i;66#pragma omp target67#pragma omp teams68#pragma omp distribute parallel for copyin // expected-error {{expected '(' after 'copyin'}}69  for (i = 0; i < argc; ++i)70    foo();71#pragma omp target72#pragma omp teams73#pragma omp distribute parallel for copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}74  for (i = 0; i < argc; ++i)75    foo();76#pragma omp target77#pragma omp teams78#pragma omp distribute parallel for copyin() // expected-error {{expected expression}}79  for (i = 0; i < argc; ++i)80    foo();81#pragma omp target82#pragma omp teams83#pragma omp distribute parallel for copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}84  for (i = 0; i < argc; ++i)85    foo();86#pragma omp target87#pragma omp teams88#pragma omp distribute parallel for copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}89  for (i = 0; i < argc; ++i)90    foo();91#pragma omp target92#pragma omp teams93#pragma omp distribute parallel for copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}94  for (i = 0; i < argc; ++i)95    foo();96#pragma omp target97#pragma omp teams98#pragma omp distribute parallel for copyin(l) // expected-error 2 {{'operator=' is a private member of 'S4'}}99  for (i = 0; i < argc; ++i)100    foo();101#pragma omp target102#pragma omp teams103#pragma omp distribute parallel for copyin(S1) // expected-error {{'S1' does not refer to a value}}104  for (i = 0; i < argc; ++i)105    foo();106#pragma omp target107#pragma omp teams108#pragma omp distribute parallel for copyin(argv[1]) // expected-error {{expected variable name}}109  for (i = 0; i < argc; ++i)110    foo();111#pragma omp target112#pragma omp teams113#pragma omp distribute parallel for copyin(i) // expected-error {{copyin variable must be threadprivate}}114  for (i = 0; i < argc; ++i)115    foo();116#pragma omp target117#pragma omp teams118#pragma omp distribute parallel for copyin(m) // expected-error 2 {{'operator=' is a private member of 'S5'}}119  for (i = 0; i < argc; ++i)120    foo();121#pragma omp target122#pragma omp teams123#pragma omp distribute parallel for copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}}124  for (i = 0; i < argc; ++i)125    foo();126}127 128int main(int argc, char **argv) {129  int i;130#pragma omp target131#pragma omp teams132#pragma omp distribute parallel for copyin // expected-error {{expected '(' after 'copyin'}}133  for (i = 0; i < argc; ++i)134    foo();135#pragma omp target136#pragma omp teams137#pragma omp distribute parallel for copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}138  for (i = 0; i < argc; ++i)139    foo();140#pragma omp target141#pragma omp teams142#pragma omp distribute parallel for copyin() // expected-error {{expected expression}}143  for (i = 0; i < argc; ++i)144    foo();145#pragma omp target146#pragma omp teams147#pragma omp distribute parallel for copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}148  for (i = 0; i < argc; ++i)149    foo();150#pragma omp target151#pragma omp teams152#pragma omp distribute parallel for copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}153  for (i = 0; i < argc; ++i)154    foo();155#pragma omp target156#pragma omp teams157#pragma omp distribute parallel for copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}158  for (i = 0; i < argc; ++i)159    foo();160#pragma omp target161#pragma omp teams162#pragma omp distribute parallel for copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}163  for (i = 0; i < argc; ++i)164    foo();165#pragma omp target166#pragma omp teams167#pragma omp distribute parallel for copyin(S1) // expected-error {{'S1' does not refer to a value}}168  for (i = 0; i < argc; ++i)169    foo();170#pragma omp target171#pragma omp teams172#pragma omp distribute parallel for copyin(argv[1]) // expected-error {{expected variable name}}173  for (i = 0; i < argc; ++i)174    foo();175#pragma omp target176#pragma omp teams177#pragma omp distribute parallel for copyin(i) // expected-error {{copyin variable must be threadprivate}}178  for (i = 0; i < argc; ++i)179    foo();180#pragma omp target181#pragma omp teams182#pragma omp distribute parallel for copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}183  for (i = 0; i < argc; ++i)184    foo();185#pragma omp target186#pragma omp teams187#pragma omp distribute parallel for copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}}188  for (i = 0; i < argc; ++i)189    foo();190 191  return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}}192}193