llvm-project/clang/test/OpenMP/deferred-diags.cpp
Yaxun (Sam) Liu 3ef11346f3 Fix DeferredDiagnosticsEmitter for bug#45987
InOMPDeviceContext may be greater than 1. It needs to be clamp to 0 and 1
to be used as index for DoneMap.
2020-05-21 11:01:40 -04:00

36 lines
677 B
C++

// RUN: %clang_cc1 -triple x86_64 -verify=expected,dev -std=c++11\
// RUN: -verify-ignore-unexpected=note \
// RUN: -fopenmp -fopenmp-version=50 -o - %s
// expected-no-diagnostics
// Test no infinite recursion in DeferredDiagnosticEmitter.
constexpr int foo(int *x) {
return 0;
}
int a = foo(&a);
// Test no crash when both caller and callee have target directives.
int foo();
class B {
public:
void barB(int *isHost) {
#pragma omp target map(tofrom: isHost)
{
*isHost = foo();
}
}
};
class A : public B {
public:
void barA(int *isHost) {
#pragma omp target map(tofrom: isHost)
{
barB(isHost);
}
}
};