brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · a89d346 Raw
121 lines · cpp
1// RUN: %clang_cc1 %s -fopenacc -verify2 3struct S {4  int IntMem;5  int *PtrMem;6  operator int*();7};8 9void uses() {10  int LocalInt;11  int *LocalPtr;12  int Array[5];13  int *PtrArray[5];14  struct S s;15 16  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}17#pragma acc parallel attach(LocalInt)18  while (true);19 20#pragma acc parallel attach(LocalPtr)21  while (true);22 23  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int[5]'}}24#pragma acc parallel attach(Array)25  while (true);26 27  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}28#pragma acc parallel attach(Array[0])29  while (true);30 31  // expected-error@+2{{OpenACC sub-array is not allowed here}}32  // expected-note@+1{{expected variable of pointer type}}33#pragma acc parallel attach(Array[0:1])34  while (true);35 36  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int *[5]'}}37#pragma acc parallel attach(PtrArray)38  while (true);39 40#pragma acc parallel attach(PtrArray[0])41  while (true);42 43  // expected-error@+2{{OpenACC sub-array is not allowed here}}44  // expected-note@+1{{expected variable of pointer type}}45#pragma acc parallel attach(PtrArray[0:1])46  while (true);47 48  // expected-error@+1{{expected pointer in 'attach' clause, type is 'struct S'}}49#pragma acc parallel attach(s)50  while (true);51 52  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}53#pragma acc parallel attach(s.IntMem)54  while (true);55 56#pragma acc parallel attach(s.PtrMem)57  while (true);58}59 60template<typename T, typename TPtr, typename TStruct, auto &R1>61void Templ() {62  T SomeInt;63  TPtr SomePtr;64  T SomeIntArray[5];65  TPtr SomeIntPtrArray[5];66  TStruct SomeStruct;67 68  // expected-error@+2{{expected pointer in 'attach' clause, type is 'int'}}69  // expected-note@#INST{{in instantiation of function template specialization}}70#pragma acc parallel attach(SomeInt)71  while (true);72 73#pragma acc parallel attach(SomePtr)74  while (true);75 76  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int[5]'}}77#pragma acc parallel attach(SomeIntArray)78  while (true);79 80  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}81#pragma acc parallel attach(SomeIntArray[0])82  while (true);83 84  // expected-error@+2{{OpenACC sub-array is not allowed here}}85  // expected-note@+1{{expected variable of pointer type}}86#pragma acc parallel attach(SomeIntArray[0:1])87  while (true);88 89  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int *[5]'}}90#pragma acc parallel attach(SomeIntPtrArray)91  while (true);92 93#pragma acc parallel attach(SomeIntPtrArray[0])94  while (true);95 96  // expected-error@+2{{OpenACC sub-array is not allowed here}}97  // expected-note@+1{{expected variable of pointer type}}98#pragma acc parallel attach(SomeIntPtrArray[0:1])99  while (true);100 101  // expected-error@+1{{expected pointer in 'attach' clause, type is 'S'}}102#pragma acc parallel attach(SomeStruct)103  while (true);104 105  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}106#pragma acc parallel attach(SomeStruct.IntMem)107  while (true);108 109#pragma acc parallel attach(SomeStruct.PtrMem)110  while (true);111 112  // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}113#pragma acc parallel attach(R1)114  while (true);115}116 117void inst() {118  static constexpr int CEVar = 1;119  Templ<int, int*, S, CEVar>(); // #INST120}121