1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // PR7800
3 
4 class NoDestroy { ~NoDestroy(); }; // expected-note 3 {{declared private here}}
5 struct A {
6   virtual ~A();
7 };
8 
9 struct B : public virtual A {
10   NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
11 };
12 struct D : public virtual B {
13   virtual void foo();
14   ~D();
15 };
16 void D::foo() { // expected-note {{implicit destructor for 'B' first required here}}
17 }
18 
19 struct E : public virtual A {
20   NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
21 };
22 struct F : public E { // expected-note {{implicit destructor for 'E' first required here}}
23 };
24 struct G : public virtual F {
25   virtual void foo();
26   ~G();
27 };
28 void G::foo() { // expected-note {{implicit destructor for 'F' first required here}}
29 }
30 
31 struct H : public virtual A {
32   NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
33 };
34 struct I : public virtual H {
35   ~I();
36 };
37 struct J : public I {
38   virtual void foo();
39   ~J();
40 };
41 void J::foo() { // expected-note {{implicit destructor for 'H' first required here}}
42 }
43