llvm-project/clang/test/SemaOpenACC/compute-construct-default-clause.cpp
erichkeane 2b939e182d [OpenACC] Implement auto/seq/independent clause Sema for 'loop'
These three clauses are all quite trivial, as they take no parameters.
They are mutually exclusive, and 'seq' has some other exclusives that
are implemented here.

The ONE thing that isn't implemented is 2.9's restriction (line 2010):
  'A loop associated with a 'loop' construct that does not have a 'seq'
   clause must be written to meet all the following conditions'.

Future clauses will require similar work, so it'll be done as a
followup.
2024-06-05 10:17:21 -07:00

33 lines
1.0 KiB
C++

// RUN: %clang_cc1 %s -fopenacc -verify
template<typename T>
void SingleOnly() {
#pragma acc parallel default(none)
while(false);
int i;
// expected-error@+2{{OpenACC 'default' clause cannot appear more than once on a 'parallel' directive}}
// expected-note@+1{{previous clause is here}}
#pragma acc parallel default(present) async default(none)
while(false);
// expected-error@+2{{OpenACC 'default' clause cannot appear more than once on a 'serial' directive}}
// expected-note@+1{{previous clause is here}}
#pragma acc serial async default(present) copy(i) default(none) self
while(false);
// expected-error@+2{{OpenACC 'default' clause cannot appear more than once on a 'kernels' directive}}
// expected-note@+1{{previous clause is here}}
#pragma acc kernels async default(present) copy(i) default(none) self
while(false);
// expected-error@+1{{expected '('}}
#pragma acc parallel async default(none) copy(i) default self
while(false);
}
void Instantiate() {
SingleOnly<int>();
}