xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/implicit-virtual-member-functions.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc struct A {
3*f4a2713aSLionel Sambuc   virtual ~A();
4*f4a2713aSLionel Sambuc };
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}}
7*f4a2713aSLionel Sambuc   virtual void f();
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc   void operator delete (void *, int); // expected-note {{'operator delete' declared here}}
10*f4a2713aSLionel Sambuc };
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc void B::f() { // expected-note {{implicit destructor for 'B' first required here}}
13*f4a2713aSLionel Sambuc }
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}}
16*f4a2713aSLionel Sambuc   C();
17*f4a2713aSLionel Sambuc   void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
18*f4a2713aSLionel Sambuc };
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc C::C() { }  // expected-note {{implicit destructor for 'C' first required here}}
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc struct D : A { // expected-error {{no suitable member 'operator delete' in 'D'}}
23*f4a2713aSLionel Sambuc   void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
24*f4a2713aSLionel Sambuc };
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc void f() {
27*f4a2713aSLionel Sambuc   new D; // expected-note {{implicit destructor for 'D' first required here}}
28*f4a2713aSLionel Sambuc }
29*f4a2713aSLionel Sambuc 
30