1 | // RUN: %clang_cc1 -fmodules -verify %s |
2 | // expected-no-diagnostics |
3 | |
4 | #pragma clang module build M |
5 | module M {} |
6 | #pragma clang module contents |
7 | #pragma clang module begin M |
8 | struct A { |
9 | A(); |
10 | ~A() { delete p; } // expected-warning {{'delete' applied to a pointer that was allocated with 'new[]'}} |
11 | int *p; |
12 | }; |
13 | inline A::A() : p(new int[32]) {} // expected-note {{allocated}} |
14 | struct B { |
15 | B(); |
16 | ~B() { delete p; } |
17 | int *p; |
18 | }; |
19 | #pragma clang module end |
20 | #pragma clang module endbuild |
21 | |
22 | #pragma clang module import M |
23 | B::B() : p(new int[32]) {} |
24 | |