1 static assert(!hasElaborateDestructor!int); 2 3 static struct S1 { } 4 static struct S2 { ~this() {} } 5 static struct S3 { S2 field; } 6 static struct S4 { S3[1] field; } 7 static struct S5 { S3[] field; } 8 static struct S6 { S3[0] field; } 9 static struct S7 { @disable this(); S3 field; } 10 static assert(!hasElaborateDestructor!S1); 11 static assert( hasElaborateDestructor!S2); 12 static assert( hasElaborateDestructor!(immutable S2)); 13 static assert( hasElaborateDestructor!S3); 14 static assert( hasElaborateDestructor!(S3[1])); 15 static assert(!hasElaborateDestructor!(S3[0])); 16 static assert( hasElaborateDestructor!S4); 17 static assert(!hasElaborateDestructor!S5); 18 static assert(!hasElaborateDestructor!S6); 19 static assert( hasElaborateDestructor!S7);
True if S or any type directly embedded in the representation of S defines an elaborate destructor. Elaborate destructors are introduced by defining ~this() for a struct.
Classes and unions never have elaborate destructors, even though classes may define ~this().