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_constructor(T1), "T1 has trivial constructor!"); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct T2 { 8*f4a2713aSLionel Sambuc T2(); 9*f4a2713aSLionel Sambuc }; 10*f4a2713aSLionel Sambuc static_assert(!__has_trivial_constructor(T2), "T2 has a user-declared constructor!"); 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc struct T3 { 13*f4a2713aSLionel Sambuc virtual void f(); 14*f4a2713aSLionel Sambuc }; 15*f4a2713aSLionel Sambuc static_assert(!__has_trivial_constructor(T3), "T3 has a virtual function!"); 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc struct T4 : virtual T3 { 18*f4a2713aSLionel Sambuc }; 19*f4a2713aSLionel Sambuc static_assert(!__has_trivial_constructor(T4), "T4 has a virtual base class!"); 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc struct T5 : T1 { 22*f4a2713aSLionel Sambuc }; 23*f4a2713aSLionel Sambuc static_assert(__has_trivial_constructor(T5), "All the direct base classes of T5 have trivial constructors!"); 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_constructor(T6), "All nonstatic data members of T6 have trivial constructors!"); 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc struct T7 { 33*f4a2713aSLionel Sambuc T4 t4; 34*f4a2713aSLionel Sambuc }; 35*f4a2713aSLionel Sambuc static_assert(!__has_trivial_constructor(T7), "t4 does not have a trivial constructor!"); 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc struct T8 : T2 { 38*f4a2713aSLionel Sambuc }; 39*f4a2713aSLionel Sambuc static_assert(!__has_trivial_constructor(T8), "The base class T2 does not have a trivial constructor!"); 40