187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// RUN: %clang_cc1 -verify -fopenmp %s 287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarnamespace X { 487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarint x; 587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar}; 687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarstruct B { 887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar static int ib; // expected-note {{'B::ib' declared here}} 987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar static int bfoo() { return 8; } 1087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar}; 1187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 1287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarint bfoo() { return 4; } 1387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 1487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarint z; 1587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarconst int C1 = 1; 1687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarconst int C2 = 2; 1787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarvoid test_linear_colons() { 1887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int B = 0; 1987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B : bfoo()) 2087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 2187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 2287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}} 2387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B::ib : B : bfoo()) 2487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 2587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 2687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{use of undeclared identifier 'ib'; did you mean 'B::ib'}} 2787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B : ib) 2887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 2987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 3087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}} 3187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(z : B : ib) 3287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 3387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 3487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B : B::bfoo()) 3587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 3687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 3787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(X::x : ::z) 3887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 3987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 4087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B, ::z, X::x) 4187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 4287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 4387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(::z) 4487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 4587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 4687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{expected variable name}} 4787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B::bfoo()) 4887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 4987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 5087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(B::ib, B : C1 + C2) 5187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 10; ++i) 5287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ; 5387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 5487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 5587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainartemplate <int L, class T, class N> 5687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga NainarT test_template(T *arr, N num) { 5787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar N i; 5887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar T sum = (T)0; 5987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar T ind2 = -num * L; // expected-note {{'ind2' defined here}} 6087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{argument of a linear clause should be of integral or pointer type}} 6187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(ind2 : L) 6287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (i = 0; i < num; ++i) { 6387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar T cur = arr[(int)ind2]; 6487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ind2 += L; 6587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar sum += cur; 6687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 6787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar return T(); 6887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 6987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 7087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainartemplate <int LEN> 7187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarint test_warn() { 7287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int ind2 = 0; 7387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-warning@+1 {{zero linear step (ind2 should probably be const)}} 7487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(ind2 : LEN) 7587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int i = 0; i < 100; i++) { 7687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ind2 += LEN; 7787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 7887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar return ind2; 7987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 8087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 8187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarstruct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} 8287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarextern S1 a; 8387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarclass S2 { 8487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar mutable int a; 8587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 8687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarpublic: 8787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S2() : a(0) {} 8887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar}; 8987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarconst S2 b; // expected-note 2 {{'b' defined here}} 9087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarconst S2 ba[5]; 9187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarclass S3 { 9287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int a; 9387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 9487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarpublic: 9587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S3() : a(0) {} 9687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar}; 9787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarconst S3 ca[5]; 9887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarclass S4 { 9987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int a; 10087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S4(); 10187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 10287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarpublic: 10387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S4(int v) : a(v) {} 10487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar}; 10587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarclass S5 { 10687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int a; 10787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S5() : a(0) {} 10887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 10987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarpublic: 11087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S5(int v) : a(v) {} 11187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar}; 11287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 11387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga NainarS3 h; 11487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} 11587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 11687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainartemplate <class I, class C> 11787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarint foomain(I argc, C **argv) { 11887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar I e(4); 11987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar I g(5); 12087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int i; 12187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int &j = i; 12287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear // expected-error {{expected '(' after 'linear'}} 12387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 12487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 12587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 12687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 12787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 12887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear() // expected-error {{expected expression}} 12987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 13087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 13187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 13287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 13387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 13487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 13587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 13687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 13787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 13887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 13987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 14087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc : 5) 14187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 14287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 14387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(S1) // expected-error {{'S1' does not refer to a value}} 14487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 14587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 14687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+2 {{linear variable with incomplete type 'S1'}} 14787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{const-qualified variable cannot be linear}} 14887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(a, b : B::ib) 14987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 15087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 15187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argv[1]) // expected-error {{expected variable name}} 15287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 15387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 15487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(e, g) 15587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 15687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 15787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} 15887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 15987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 16087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(i) 16187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 16287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 16387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel 16487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar { 16587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int v = 0; 16687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int i; 16787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(v : i) 16887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) { 16987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar i = k; 17087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar v += i; 17187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 17287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 17387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(j) 17487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 17587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 17687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int v = 0; 17787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(v : j) 17887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) { 17987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 18087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar v += j; 18187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 18287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(i) 18387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 18487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 18587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar return 0; 18687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 18787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 18887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarnamespace A { 18987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainardouble x; 19087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} 19187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 19287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarnamespace C { 19387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarusing A::x; 19487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 19587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 19687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainarint main(int argc, char **argv) { 19787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar double darr[100]; 19887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}} 19987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar test_template<-4>(darr, 4); 20087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}} 20187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar test_warn<0>(); 20287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 20387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S4 e(4); // expected-note {{'e' defined here}} 20487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar S5 g(5); // expected-note {{'g' defined here}} 20587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int i; 20687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int &j = i; 20787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear // expected-error {{expected '(' after 'linear'}} 20887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 20987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 21087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 21187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 21287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 21387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear() // expected-error {{expected expression}} 21487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 21587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 21687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 21787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 21887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 21987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 22087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 22187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 22287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 22387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 22487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 22587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argc) 22687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 22787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 22887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(S1) // expected-error {{'S1' does not refer to a value}} 22987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 23087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 23187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+2 {{linear variable with incomplete type 'S1'}} 23287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{const-qualified variable cannot be linear}} 23387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(a, b) 23487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 23587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 23687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(argv[1]) // expected-error {{expected variable name}} 23787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 23887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 23987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+2 {{argument of a linear clause should be of integral or pointer type, not 'S4'}} 24087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar// expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}} 24187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(e, g) 24287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 24387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 24487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} 24587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 24687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 24787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel 24887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar { 24987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar int i; 25087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(i) 25187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 25287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 25387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(i : 4) 25487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) { 25587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 25687d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar i += 4; 25787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 25887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar } 25987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(j) 26087d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 26187d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 26287d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar#pragma omp parallel for linear(i) 26387d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar for (int k = 0; k < argc; ++k) 26487d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar ++k; 26587d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 2664967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar foomain<int, char>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}} 26787d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar return 0; 26887d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar} 26987d948ecccffea9e9e37d0d053b246e2d6d6c47bPirama Arumuga Nainar 270