1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2*f4a2713aSLionel Sambuc // expected-no-diagnostics 3*f4a2713aSLionel Sambuc struct T1 { 4*f4a2713aSLionel Sambuc }; 5*f4a2713aSLionel Sambuc static_assert(__has_trivial_destructor(T1), "T1 has trivial destructor!"); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct T2 { 8*f4a2713aSLionel Sambuc ~T2(); 9*f4a2713aSLionel Sambuc }; 10*f4a2713aSLionel Sambuc static_assert(!__has_trivial_destructor(T2), "T2 has a user-declared destructor!"); 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc struct T3 { 13*f4a2713aSLionel Sambuc virtual void f(); 14*f4a2713aSLionel Sambuc }; 15*f4a2713aSLionel Sambuc static_assert(__has_trivial_destructor(T3), "T3 has a virtual function (but still a trivial destructor)!"); 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc struct T4 : virtual T3 { 18*f4a2713aSLionel Sambuc }; 19*f4a2713aSLionel Sambuc static_assert(__has_trivial_destructor(T4), "T4 has a virtual base class! (but still a trivial destructor)!"); 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc struct T5 : T1 { 22*f4a2713aSLionel Sambuc }; 23*f4a2713aSLionel Sambuc static_assert(__has_trivial_destructor(T5), "All the direct base classes of T5 have trivial destructors!"); 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc struct T6 { 26*f4a2713aSLionel Sambuc T5 t5; 27*f4a2713aSLionel Sambuc T1 t1[2][2]; 28*f4a2713aSLionel Sambuc static T2 t2; 29*f4a2713aSLionel Sambuc }; 30*f4a2713aSLionel Sambuc static_assert(__has_trivial_destructor(T6), "All nonstatic data members of T6 have trivial destructors!"); 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc struct T7 { 33*f4a2713aSLionel Sambuc T2 t2; 34*f4a2713aSLionel Sambuc }; 35*f4a2713aSLionel Sambuc static_assert(!__has_trivial_destructor(T7), "t2 does not have a trivial destructor!"); 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc struct T8 : T2 { 38*f4a2713aSLionel Sambuc }; 39*f4a2713aSLionel Sambuc static_assert(!__has_trivial_destructor(T8), "The base class T2 does not have a trivial destructor!"); 40