llvm-project/clang/test/SemaOpenACC/parallel-loc-and-stmt.cpp
Erich Keane cb89112797
[OpenACC] Implement beginning parts of the 'parallel' Sema impl (#81659)
This patch Implements AST node creation and appertainment enforcement
for 'parallel', as well as changes the 'not implemented' messages to be
more specific. It does not deal with clauses/clause legality, nor a few
of the other rules from the standard, but this gets us most of the way
for a framework for future construct implementation.
2024-02-16 08:53:09 -08:00

62 lines
1.2 KiB
C++

// RUN: %clang_cc1 %s -verify -fopenacc
// expected-error@+1{{OpenACC construct 'parallel' cannot be used here; it can only be used in a statement context}}
#pragma acc parallel
// expected-error@+1{{OpenACC construct 'parallel' cannot be used here; it can only be used in a statement context}}
#pragma acc parallel
int foo;
struct S {
// expected-error@+1{{OpenACC construct 'parallel' cannot be used here; it can only be used in a statement context}}
#pragma acc parallel
int foo;
void mem_func() {
// FIXME: Should we disallow this on declarations, or consider this to be on
// the initialization?
#pragma acc parallel
int foo;
#pragma acc parallel
{
}
#pragma acc parallel
while(0){}
#pragma acc parallel
for(;;){}
// expected-error@+2{{expected statement}}
#pragma acc parallel
}
};
template<typename T>
void func() {
// FIXME: Should we disallow this on declarations, and consider this to be on
// the initialization?
#pragma acc parallel
int foo;
#pragma acc parallel
{
}
#pragma acc parallel
while(0){}
#pragma acc parallel
for(;;){}
#pragma acc parallel
#pragma acc parallel
for(;;){}
// expected-error@+2{{expected statement}}
#pragma acc parallel
};