xref: /llvm-project/clang/test/OpenMP/deferred-diags.cpp (revision 788731cdbd732180639988c9589adbe63bb28afa)
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
4 
5 // RUN: %clang_cc1 -triple x86_64 -verify=expected,dev -std=c++11\
6 // RUN:            -verify-ignore-unexpected=note \
7 // RUN:            -fopenmp -o - %s
8 
9 // Test no infinite recursion in DeferredDiagnosticEmitter.
foo(int * x)10 constexpr int foo(int *x) {
11   return 0;
12 }
13 
14 int a = foo(&a);
15 
16 // Test no crash when both caller and callee have target directives.
17 int foo();
18 
19 class B {
20 public:
barB(int * isHost)21   void barB(int *isHost) {
22   #pragma omp target map(tofrom: isHost)
23      {
24        *isHost = foo();
25      }
26   }
27 };
28 
29 class A : public B {
30 public:
barA(int * isHost)31   void barA(int *isHost) {
32   #pragma omp target map(tofrom: isHost)
33      {
34        barB(isHost);
35      }
36   }
37 };
38 
39 // Test that deleting an incomplete class type doesn't cause an assertion.
40 namespace TestDeleteIncompleteClassDefinition {
41 struct a;
42 struct b {
bTestDeleteIncompleteClassDefinition::b43   b() {
44     delete c; // expected-warning {{deleting pointer to incomplete type 'a' is incompatible with C++2c and may cause undefined behavior}}
45   }
46   a *c;
47 };
48 } // namespace TestDeleteIncompleteClassDefinition
49