116 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 {{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 {{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 {{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 63int main(int argc, char **argv) {64 int i;65#pragma omp parallel master copyin // expected-error {{expected '(' after 'copyin'}}66 {67 foo();68 }69#pragma omp parallel master copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}70 {71 foo();72 }73#pragma omp parallel master copyin() // expected-error {{expected expression}}74 {75 foo();76 }77#pragma omp parallel master copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}78 {79 foo();80 }81#pragma omp parallel master copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}82 {83 foo();84 }85#pragma omp parallel master copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}86 {87 foo();88 }89#pragma omp parallel master copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}90 {91 foo();92 }93#pragma omp parallel master copyin(S1) // expected-error {{'S1' does not refer to a value}}94 {95 foo();96 }97#pragma omp parallel master copyin(argv[1]) // expected-error {{expected variable name}}98 {99 foo();100 }101#pragma omp parallel master copyin(i) // expected-error {{copyin variable must be threadprivate}}102 {103 foo();104 }105#pragma omp parallel master copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}106 {107 foo();108 }109#pragma omp parallel master copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}}110 {111 foo();112 }113 114 return 0;115}116