brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.8 KiB · fea0454 Raw
244 lines · cpp
1// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -x c++ -std=c++11 -fms-extensions -Wno-pragma-pack %s2 3// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -x c++ -std=c++11 -fms-extensions -Wno-pragma-pack %s4 5// expected-error@+1 {{expected an OpenMP directive}}6#pragma omp declare7 8// expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}}9#pragma omp declare simd10int a;11// expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}}12#pragma omp declare simd13#pragma omp threadprivate(a)14int var;15#pragma omp threadprivate(var)16 17// expected-error@+2 {{expected an OpenMP directive}} expected-error@+1 {{function declaration is expected after 'declare simd' directive}}18#pragma omp declare simd19#pragma omp declare20 21// expected-error@+3 {{function declaration is expected after 'declare simd' directive}}22// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}23#pragma omp declare simd24#pragma omp declare simd25#pragma options align=packed26int main();27 28// expected-error@+3 {{function declaration is expected after 'declare simd' directive}}29// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}30#pragma omp declare simd31#pragma omp declare simd32#pragma init_seg(compiler)33int main();34 35struct A {36  #pragma omp declare simd37  template<typename T>38  T infunc1(T a);39};40 41// expected-error@+1 {{single declaration is expected after 'declare simd' directive}}42#pragma omp declare simd43// expected-note@+1 {{declared here}}44int b, c;45 46// expected-error@+1 {{'C' does not refer to a value}}47#pragma omp declare simd simdlen(C)48// expected-note@+1 {{declared here}}49template <class C>50void h(C *hp, C *hp2, C *hq, C *lin) {51  b = 0;52}53 54#pragma omp declare simd55template <>56void h(int *hp, int *hp2, int *hq, int *lin) {57  h((float *)hp, (float *)hp2, (float *)hq, (float *)lin);58}59 60#pragma omp declare simd inbranch inbranch61#pragma omp declare simd notinbranch notinbranch62#pragma omp declare simd inbranch inbranch notinbranch // expected-error {{unexpected 'notinbranch' clause, 'inbranch' is specified already}}63#pragma omp declare simd notinbranch notinbranch inbranch // expected-error {{unexpected 'inbranch' clause, 'notinbranch' is specified already}}64// expected-note@+2 {{read of non-const variable 'b' is not allowed in a constant expression}}65// expected-error@+1 {{integral constant expression}}66#pragma omp declare simd simdlen(b)67// expected-error@+1 {{directive '#pragma omp declare simd' cannot contain more than one 'simdlen' clause}}68#pragma omp declare simd simdlen(32) simdlen(c)69// expected-error@+1 {{expected '(' after 'simdlen'}}70#pragma omp declare simd simdlen71// expected-note@+3 {{to match this '('}}72// expected-error@+2 {{expected ')'}}73// expected-error@+1 {{expected expression}}74#pragma omp declare simd simdlen(75// expected-error@+2 {{expected '(' after 'simdlen'}}76// expected-error@+1 {{expected expression}}77#pragma omp declare simd simdlen(), simdlen78// expected-error@+1 2 {{expected expression}}79#pragma omp declare simd simdlen(), simdlen()80// expected-warning@+3 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}81// expected-error@+2 {{expected '(' after 'simdlen'}}82// expected-error@+1 {{expected expression}}83#pragma omp declare simd simdlen() simdlen)84void foo();85 86// expected-error@+3 4 {{expected reference to one of the parameters of function 'foo'}}87// expected-error@+2 {{invalid use of 'this' outside of a non-static member function}}88// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}89#pragma omp declare simd simdlen(N) uniform(this, var) aligned(var)90template<int N>91void foo() {}92 93void test() {94  // expected-note@+1 {{in instantiation of function template specialization 'foo<-3>' requested here}}95  foo<-3>();96}97 98// expected-error@+1 {{expected '(' after 'uniform'}}99#pragma omp declare simd uniform100// expected-note@+3 {{to match this '('}}101// expected-error@+2 {{expected ')'}}102// expected-error@+1 {{expected expression}}103#pragma omp declare simd uniform(104// expected-error@+1 {{expected expression}}105#pragma omp declare simd uniform()106// expected-note@+3 {{to match this '('}}107// expected-error@+2 {{expected ')'}}108// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}109#pragma omp declare simd uniform(this110// expected-note@+3 {{to match this '('}}111// expected-error@+2 {{expected ')'}}112// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}113#pragma omp declare simd uniform(this,a114// expected-error@+1 {{expected expression}}115#pragma omp declare simd uniform(,a)116// expected-error@+1 {{expected '(' after 'aligned'}}117#pragma omp declare simd aligned118// expected-note@+3 {{to match this '('}}119// expected-error@+2 {{expected ')'}}120// expected-error@+1 {{expected expression}}121#pragma omp declare simd aligned(122// expected-error@+1 {{expected expression}}123#pragma omp declare simd aligned()124// expected-error@+4 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}125// expected-note@+3 {{to match this '('}}126// expected-error@+2 {{expected ')'}}127// expected-error@+1 {{expected expression}}128#pragma omp declare simd aligned(a:129// expected-error@+1 {{expected expression}} expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}130#pragma omp declare simd aligned(a:)131// expected-warning@+2 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}132// expected-error@+1 {{expected '(' after 'aligned'}}133#pragma omp declare simd aligned :)134// expected-note@+3 {{to match this '('}}135// expected-error@+2 {{expected ')'}}136// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}137#pragma omp declare simd aligned(this138// expected-note@+3 {{to match this '('}}139// expected-error@+2 {{expected ')'}}140// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}141#pragma omp declare simd aligned(this,b142// expected-error@+1 {{expected expression}}143#pragma omp declare simd aligned(, b)144// expected-note@+4 {{defined as aligned}}145// expected-error@+3 {{a parameter cannot appear in more than one aligned clause}}146// expected-error@+2 {{expected expression}}147// expected-error@+1 {{expected ',' or ')' in 'aligned' clause}}148#pragma omp declare simd aligned(b) aligned(b ; 64)149// expected-note@+2 {{defined as aligned}}150// expected-error@+1 {{a parameter cannot appear in more than one aligned clause}}151#pragma omp declare simd aligned(b) aligned(b: 64)152// expected-error@+1 {{argument to 'aligned' clause must be a strictly positive integer value}}153#pragma omp declare simd aligned(b: -1)154// expected-warning@+1 {{aligned clause will be ignored because the requested alignment is not a power of 2}}155#pragma omp declare simd aligned(b: 3)156// expected-error@+1 {{expected '(' after 'linear'}}157#pragma omp declare simd linear158// expected-note@+3 {{to match this '('}}159// expected-error@+2 {{expected ')'}}160// expected-error@+1 {{expected expression}}161#pragma omp declare simd linear(162// expected-error@+1 {{expected expression}}163#pragma omp declare simd linear()164// expected-note@+3 {{to match this '('}}165// expected-error@+2 {{expected ')'}}166// expected-error@+1 {{expected expression}}167#pragma omp declare simd linear(a:168// expected-error@+1 {{expected expression}}169#pragma omp declare simd linear(a:)170// expected-warning@+2 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}171// expected-error@+1 {{expected '(' after 'linear'}}172#pragma omp declare simd linear :)173// expected-note@+3 {{to match this '('}}174// expected-error@+2 {{expected ')'}}175// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}176#pragma omp declare simd linear(this177// expected-note@+3 {{to match this '('}}178// expected-error@+2 {{expected ')'}}179// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}180#pragma omp declare simd linear(this,b181// expected-error@+1 {{expected expression}}182#pragma omp declare simd linear(, b)183// expected-note@+4 {{defined as linear}}184// expected-error@+3 {{linear variable cannot be linear}}185// expected-error@+2 {{expected expression}}186// expected-error@+1 {{expected ',' or ')' in 'linear' clause}}187#pragma omp declare simd linear(b) linear(b ; 64)188// expected-note@+2 {{defined as linear}}189// expected-error@+1 {{linear variable cannot be linear}}190#pragma omp declare simd linear(b) linear(b: 64)191#pragma omp declare simd linear(b: -1)192#pragma omp declare simd linear(b: 3)193// expected-error@+1 {{expected a reference to a parameter specified in a 'uniform' clause}}194#pragma omp declare simd linear(b: a)195// expected-note@+2 {{defined as uniform}}196// expected-error@+1 {{linear variable cannot be uniform}}197#pragma omp declare simd uniform(a), linear(a: 4)198// expected-note@+2 {{defined as uniform}}199// expected-error@+1 {{linear variable cannot be uniform}}200#pragma omp declare simd linear(a: 4) uniform(a)201// expected-error@+1 {{variable of non-reference type 'int *' can be used only with 'val' modifier, but used with 'uval'}}202#pragma omp declare simd linear(uval(b))203// expected-error@+1 {{variable of non-reference type 'int *' can be used only with 'val' modifier, but used with 'ref'}}204#pragma omp declare simd linear(ref(b))205// expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}} expected-warning@+1 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}206#pragma omp declare simd linear(uref(b)) allocate(b)207#pragma omp declare simd linear(ref(c))208// expected-note@+2 {{'a' declared here}}209// expected-note@+1 {{'a' declared here}}210void bar(int a, int *b, float &c);211 212template <class T>213struct St {214// expected-error@+2 {{function declaration is expected after 'declare simd' directive}}215#pragma init_seg(compiler)216#pragma omp declare simd217#pragma init_seg(compiler)218// expected-note@+7 {{defined as uniform}}219// expected-error@+6 {{expected a reference to a parameter specified in a 'uniform' clause}}220// expected-error@+5 {{linear variable cannot be uniform}}221// expected-note@+4 {{defined as aligned}}222// expected-error@+3 {{argument to 'aligned' clause must be a strictly positive integer value}}223// expected-error@+2 {{'this' cannot appear in more than one aligned clause}}224// expected-error@+1 {{use of undeclared identifier 't'}}225#pragma omp declare simd uniform(this, t) aligned(this: 4) aligned(this: -4) linear(this: hp)226  void h(T *hp) {227// expected-error@+1 {{unexpected OpenMP directive '#pragma omp declare simd'}}228#pragma omp declare simd229    *hp = *t;230  }231 232private:233  T t;234};235 236namespace N {237  // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}238  #pragma omp declare simd239}240// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}241#pragma omp declare simd242// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}243#pragma omp declare simd244