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