1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++11 -fblocks -Wno-deprecated-builtins -fms-extensions -Wno-microsoft %s -Wno-c++17-extensions
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++14 -fblocks -Wno-deprecated-builtins -fms-extensions -Wno-microsoft %s -Wno-c++17-extensions
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++1z -fblocks -Wno-deprecated-builtins -fms-extensions -Wno-microsoft %s
4 // RUN: %clang_cc1 -x c -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu11 -fblocks -Wno-deprecated-builtins -fms-extensions -Wno-microsoft %s
8 // expected-no-diagnostics
12 struct NonPOD
{ NonPOD(int); };
14 struct POD
{ Enum e
; int i
; float f
; NonPOD
* p
; };
15 struct Derives
: POD
{};
16 using ClassType
= Derives
;
18 union Union
{ int i
; float f
; };
20 struct HasAnonymousUnion
{
27 struct FinalClass final
{
31 struct PotentiallyFinal
{ };
34 struct PotentiallyFinal
<T
*> final
{ };
37 struct PotentiallyFinal
<int> final
{ };
39 struct SealedClass sealed
{
43 struct PotentiallySealed
{ };
46 struct PotentiallySealed
<T
*> sealed
{ };
49 struct PotentiallySealed
<int> sealed
{ };
52 static_assert(__is_final(SealedClass
));
53 static_assert(__is_final(PotentiallySealed
<float*>));
54 static_assert(__is_final(PotentiallySealed
<int>));
56 static_assert(!__is_final(PotentiallyFinal
<float>));
57 static_assert(!__is_final(PotentiallySealed
<float>));
62 static_assert(__is_sealed(SealedClass
));
63 static_assert(__is_sealed(PotentiallySealed
<float*>));
64 static_assert(__is_sealed(PotentiallySealed
<int>));
65 static_assert(__is_sealed(FinalClass
));
66 static_assert(__is_sealed(PotentiallyFinal
<float*>));
67 static_assert(__is_sealed(PotentiallyFinal
<int>));
69 static_assert(!__is_sealed(int));
70 static_assert(!__is_sealed(Union
));
71 static_assert(!__is_sealed(Int
));
72 static_assert(!__is_sealed(Int
[10]));
73 static_assert(!__is_sealed(Union
[10]));
74 static_assert(!__is_sealed(Derives
));
75 static_assert(!__is_sealed(ClassType
));
76 static_assert(!__is_sealed(const void));
77 static_assert(!__is_sealed(Int
[]));
78 static_assert(!__is_sealed(HasAnonymousUnion
));
79 static_assert(!__is_sealed(PotentiallyFinal
<float>));
80 static_assert(!__is_sealed(PotentiallySealed
<float>));
85 void is_destructible()
87 (void)__is_destructible(int);
88 (void)__is_destructible(struct s1
);
89 (void)__is_destructible(struct s2
); // expected-error{{incomplete type 'struct s2' used in type trait expression}}
90 // expected-note@-1{{}}