[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / deferred-diags.cpp
blobe31b99b8c88e45768355e5b35838a668d6b9ae41
1 // RUN: %clang_cc1 -triple x86_64 -verify=expected,dev -std=c++11\
2 // RUN: -verify-ignore-unexpected=note \
3 // RUN: -fopenmp -fopenmp-version=45 -o - %s
5 // RUN: %clang_cc1 -triple x86_64 -verify=expected,dev -std=c++11\
6 // RUN: -verify-ignore-unexpected=note \
7 // RUN: -fopenmp -o - %s
9 // Test no infinite recursion in DeferredDiagnosticEmitter.
10 constexpr int foo(int *x) {
11 return 0;
14 int a = foo(&a);
16 // Test no crash when both caller and callee have target directives.
17 int foo();
19 class B {
20 public:
21 void barB(int *isHost) {
22 #pragma omp target map(tofrom: isHost)
24 *isHost = foo();
29 class A : public B {
30 public:
31 void barA(int *isHost) {
32 #pragma omp target map(tofrom: isHost)
34 barB(isHost);
39 // Test that deleting an incomplete class type doesn't cause an assertion.
40 namespace TestDeleteIncompleteClassDefinition {
41 struct a;
42 struct b {
43 b() {
44 delete c; // expected-warning {{deleting pointer to incomplete type 'a' is incompatible with C++2c and may cause undefined behavior}}
46 a *c;
48 } // namespace TestDeleteIncompleteClassDefinition