[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / implicit-virtual-member-functions.cpp
blob319cad75864ecd24b92cc65e0eaf4b14f8a1664f
1 // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s
4 // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s
5 // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s
6 // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s
8 struct A {
9 virtual ~A();
10 #if __cplusplus >= 201103L
11 // expected-note@-2 3 {{overridden virtual function is here}}
12 #endif
15 struct B : A {
16 #if __cplusplus <= 199711L
17 // expected-error@-2 {{no suitable member 'operator delete' in 'B'}}
18 #else
19 // expected-error@-4 {{deleted function '~B' cannot override a non-deleted function}}
20 // expected-note@-5 {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
21 #ifdef MSABI
22 // expected-note@-7 {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
23 #endif
24 #endif
25 virtual void f();
27 void operator delete (void *, int);
28 #if __cplusplus <= 199711L
29 // expected-note@-2 {{'operator delete' declared here}}
30 #endif
33 #ifdef MSABI
34 B b;
35 #if __cplusplus <= 199711L
36 // expected-note@-2 {{implicit destructor for 'B' first required here}}
37 #else
38 // expected-error@-4 {{attempt to use a deleted function}}
39 #endif
41 #else
42 void B::f() {
43 #if __cplusplus <= 199711L
44 // expected-note@-2 {{implicit destructor for 'B' first required here}}
45 #endif
47 #endif
49 struct C : A {
50 #if __cplusplus <= 199711L
51 // expected-error@-2 {{no suitable member 'operator delete' in 'C'}}
52 #else
53 // expected-error@-4 {{deleted function '~C' cannot override a non-deleted function}}
54 // expected-note@-5 {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
55 #endif
57 C();
58 void operator delete(void *, int);
59 #if __cplusplus <= 199711L
60 // expected-note@-2 {{'operator delete' declared here}}
61 #endif
64 C::C() { }
65 #if __cplusplus <= 199711L
66 // expected-note@-2 {{implicit destructor for 'C' first required here}}
67 #endif
69 struct D : A {
70 #if __cplusplus <= 199711L
71 // expected-error@-2 {{no suitable member 'operator delete' in 'D'}}
72 #else
73 // expected-error@-4 {{deleted function '~D' cannot override a non-deleted function}}
74 // expected-note@-5 {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
75 #endif
76 void operator delete(void *, int);
77 #if __cplusplus <= 199711L
78 // expected-note@-2 {{'operator delete' declared here}}
79 #endif
80 };
82 void f() {
83 new D;
84 #if __cplusplus <= 199711L
85 // expected-note@-2 {{implicit destructor for 'D' first required here}}
86 #endif