1 // RUN: %clang_cc1 -verify %s
3 // If the object being deleted has incomplete class type at the point of
4 // deletion and the complete class has a non-trivial destructor or a
5 // deallocation function, the behavior is undefined.
8 class T0
; // expected-note {{forward declaration}}
9 void f0(T0
*a
) { delete a
; } // expected-warning {{deleting pointer to incomplete type}}
12 // The trivial case, inside a template instantiation.
14 struct T1_A
{ T
*x
; ~T1_A() { delete x
; } }; // expected-warning {{deleting pointer to incomplete type}}
15 class T1_B
; // expected-note {{forward declaration}}
16 void f0() { T1_A
<T1_B
> x
; } // expected-note {{in instantiation of member function}}
18 // This case depends on when we check T2_C::f0.
21 struct T2_B
{ void f0(T
*a
) { delete a
; } };
22 struct T2_C
{ T2_B
<T2_A
> x
; void f0(T2_A
*a
) { x
.f0(a
); } };
23 void f0(T2_A
*a
) { T2_C x
; x
.f0(a
); }
26 // An alternate version of the same.
31 delete a
; // expected-error{{calling a private destructor of class 'T3_A'}}
38 x
.f0(a
); // expected-note{{in instantiation of member function 'T3_B<T3_A>::f0' requested here}}
42 void f0(T3_A
*a
) { T3_C x
; x
.f0(a
); }
45 ~T3_A(); // expected-note{{declared private here}}