// RUN: %clang_cc1 -verify -std=c++11 %s -Wno-defaulted-function-deleted -triple x86_64-linux-gnu
;
;
;
// A defaulted destructor for a class X is defined as deleted if:
// -- X is a union-like class that has a variant member with a non-trivial
// destructor.
;
A1 a1; // expected-error {{deleted function}}
;
A2 a2; // expected-error {{deleted function}}
;
A3 a3; // expected-error {{deleted function}}
;
A4 a4; // expected-error {{deleted function}}
// -- any of the non-static data members has class type M (or array thereof) and
// M has a deleted or inaccessible destructor.
;
B1 b1; // expected-error {{deleted function}}
;
B2 b2; // expected-error {{deleted function}}
;
B3 b3; // expected-error {{deleted function}}
;
B4 b4; // expected-error {{deleted function}}
;
B5 b5; // expected-error {{deleted function}}
;
B6 b6; // expected-error {{deleted function}}
// -- any direct or virtual base class has a deleted or inaccessible destructor.
c1; // expected-error {{deleted function}} expected-note {{base class 'DeletedDtor' has a deleted destructor}}
c2; // expected-error {{deleted function}} expected-note {{base class 'InaccessibleDtor' has an inaccessible destructor}}
c3; // expected-error {{deleted function}} expected-note {{base class 'DeletedDtor' has a deleted destructor}}
c4; // expected-error {{deleted function}} expected-note {{base class 'InaccessibleDtor' has an inaccessible destructor}}
// -- for a virtual destructor, lookup of the non-array deallocation function
// results in an ambiguity or a function that is deleted or inaccessible.
d1; // ok
d2; // expected-error {{deleted function}}
d3; // expected-error {{deleted function}}
d4; // expected-error {{deleted function}}
d5;
// expected-error {{'operator delete' is a private member of 'D1'}}
;